I use the code below from one Stackoverflow answer to abort AJAX call in JavaScript/jQuery.
$.xhrPool.abortAll = function () {
// alert('aborting.... outside');
$(this).each(function (idx, jqXHR) {
//jqXHR.abort();
if (jqXHR && jqXHR.readyState != 4) {
alert('aborting.... outside');
jqXHR.abort();
}
});
$.xhrPool.length = 0
clearTimeout(timeoutOfCall);
timeoutOfCall = null;
};
But, when I call this function like this :
$.xhrPool.abortAll();
it generate error in "unknown property" in IE 9 and also not working in Chrome. It is only working in FF.
If your whant to stop specific ajax call and your jquery is 1.5.1 or newest your can use method "abort" of jqXHR object.
var jqxhr = $.ajax(your ajax call);
jqxhr.abort();