Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Try to cancel all jQuery AJAX requests currently running
$.xhrPool = [];
$.xhrPool.abortAll = function() {
$.xhrPool.forEach(function(jqXHR) {
jqXHR.abort();
});
};
$.rails.ajax = function(options){
var req = $.ajax(options);
$.xhrPool.push(req);
return req;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.