JQuery form plugin - interrupt request

I am trying to cancel a jQuery form ajax request plugin.

NOTE: I am talking about this plugin http://jquery.malsup.com/form , not$.ajax()

I usually do this to abort the request $.ajax():

if(typeof this.query !== 'undefined'){
    this.query.abort();
}

this.query = jQuery.ajax({
...
...
});

but jQuery from the plugin , this does not work. I saw some solutions on SO that uses beforeSendfor interrupt, but this solution will not work for me.

I want to check if an ajax request is being executed for the same form, and then abort the previous request before sending a new request.

Please suggest a way to cancel jQuery from .

thank

+4
1

xhr malsup :

var form = $('#myForm').ajaxSubmit({ ... });
var xhr = form.data('jqxhr');

xhr.abort();
+4

All Articles