Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if( jQuery.ajaxPrefilter ) {
- jQuery.ajaxPrefilter(function( options, _, xhr ) {
- var port = settings.port;
- if( settings.mode === "abort" ) {
- if ( pendingRequests[port] ) {
- pendingRequests[port].abort();
- }
- pendingRequests[port] = xhr;
- }
- });
- } else {
- (function($) {
- var ajax = $.ajax;
- var pendingRequests = {};
- $.ajax = function(settings) {
- // create settings for compatibility with ajaxSetup
- settings = $.extend(settings, $.extend({}, $.ajaxSettings, settings));
- var port = settings.port;
- if (settings.mode == "abort") {
- if ( pendingRequests[port] ) {
- pendingRequests[port].abort();
- }
- return (pendingRequests[port] = ajax.apply(this, arguments));
- }
- return ajax.apply(this, arguments);
- };
- })(jQuery);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement