The jQuery form plugin does not respond very well to Firefox

Referring to the plugin: http://malsup.com/jquery/form/#getting-started

I recently tried to switch from the old v2.28 to v2.96, but I can’t, because a new error appears when I try to use FireFox to submit a form loaded using another Ajax call.

I have two kinds of forms: those that I download without calling Ajax and others that load from the server. I use ajaxForm () to bind:

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 Chrome and IE, the code works well, and both showRequest and showResponse are called and populated with the appropriate parameters. With the latest FireFox (v10.0.2), only showRequest is called, but showResponse is never called. FireBug clearly shows that the feed is not running at all. There are no error messages or warnings in the console window. I really don’t know what can cause such a difference in behavior.

Keep in mind that all this code worked perfectly on all browsers in the old version v2.28

Is anyone

The question is cross-posted at https://forum.jquery.com/topic/jquery-form-plugin-not-responding-well-with-firefox

thanks

+6
source share
2 answers

It seems that there was an error in version 2.96 and now I have updated to version v3.02.

+4
source

I also had problems with jQuery forms, 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; }); } 
+6
source

Source: https://habr.com/ru/post/909599/


All Articles