-
-
Save trashhalo/52d6064f85397ffa529e to your computer and use it in GitHub Desktop.
Try to cancel all jQuery AJAX requests currently running
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$.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