Is it possible to stop the current ajax request from within the jquery global event ajaxStart?
.ajaxStart
doesn't have access to the xhr object. .ajaxSend
does, however. You can stop it there. I don't know why you would want to do this, but remember that this is a global ajax event -- so this effectively stops all ajax requests(or at least those that don't have the global:false
flag).
$('some-object').ajaxSend(function(e, xhr) {
xhr.abort();
});
FYI there's a third argument also which is the Ajax Options object used to create the request in case that is of help...
|
|
\| /
\/
$('some-object').ajaxSend(function(e, xhr, options) {
xhr.abort();
});
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