Only on chrome...
<form action="http://example.com" method="get" target="_blank">
<input type="text" name="somename" value="some val">
<input type="submit">
</form>
exec this js from console, timeout func or whatever...
document.forms[0].submit();
If submit is triggered by actual clicking on "submit" button, form will work normally, but if submit is triggered via javascript it will open popup.
I need form exactly like this (method get, target blank) and submit has to be triggered via javascript because there are several ajax requests to be completed before submit...
Does anyone knows workaround?
FOR: Duncan Cowan
$('button').on('click', function(){
// Validation
// foo
// bar
// ...
// var errors = true;
window.promises = new Array;
// do ajax calls and add hidden inputs...
window.promises.push($.ajax({ /* Call ...*/ }));
window.promises.push($.ajax({ /* Call ...*/ }));
window.promises.push($.ajax({ /* Call ...*/ }));
// not always the case
var promis = true;
// once inputs are placed... submit
if (promis) {
$.when.apply($, window.promises).done(function() {
// Do submit
$('form').trigger('submit');
});
}
// errors or promises cancel submit
if ( errors || promis ) {
return false;
}
});