Referring to the plugin: http://malsup.com/jquery/form/#getting-started
I've recently tried to upgrade from old v2.28 to v2.96 but cannot as there appears to be a new bug introduced when trying to use FireFox to submit a form that has been loaded using another Ajax call.
I have two kinds of forms: ones that I load without an Ajax call and other that I load from the server. I use ajaxForm() for the binding:
function bindAjaxResponse() {
// Bind for Ajax POST
var options = {
delegation: true,
//target: '#output1', // target element(s) to be updated with server response
beforeSubmit: showRequest, // pre-submit callback
success: showResponse // post-submit callback
};
$('#my_form').ajaxForm(options);
}
In both Chrome and IE, the code works well and both showRequest and showResponse are called and filled with proper parameters. With latest FireFox (v10.0.2) only showRequest is called but showResponse is never called. FireBug clearly shows that no submission is done at all. There are no error messages nor warnings in the console window. I really have no idea what could trigger such a difference in behavior.
Please mind that all this code worked perfectly on all browser in the older version v2.28
Anyone?
Question cross-posted on https://forum.jquery.com/topic/jquery-form-plugin-not-responding-well-with-firefox
Thanks
I was having problems with jQuery forms as well, so I just call $.ajax directly:
function bindAjaxResponse() {
// Bind for Ajax POST
$('#my_form').submit( function() {
var datastream = $(this).serialize();
console.log('Submitting form');
$.ajax({
type: 'post',
url: $(this).form.attr('action'),
data: datastream,
timeout: 2000,
error: function() {
console.log("Failed to submit");
},
success: function(data) {
console.log('Successfully submitted form');
console.log(data);
}
});
return false;
});
}
Seems there was a bug in v2.96 and as I now upgraded to v3.02 it is solved.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With