daily pastebin goal
27%
SHARE
TWEET

Untitled

a guest Jan 26th, 2011 238 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. if( jQuery.ajaxPrefilter ) {
  2.     jQuery.ajaxPrefilter(function( options, _, xhr ) {
  3.         var port = settings.port;
  4.         if( settings.mode === "abort" ) {
  5.                 if ( pendingRequests[port] ) {
  6.                    pendingRequests[port].abort();
  7.                 }
  8.                 pendingRequests[port] = xhr;
  9.         }
  10.     });
  11. } else {
  12.     (function($) {
  13.         var ajax = $.ajax;
  14.         var pendingRequests = {};
  15.         $.ajax = function(settings) {
  16.                 // create settings for compatibility with ajaxSetup
  17.                 settings = $.extend(settings, $.extend({}, $.ajaxSettings, settings));
  18.                 var port = settings.port;
  19.                 if (settings.mode == "abort") {
  20.                         if ( pendingRequests[port] ) {
  21.                                 pendingRequests[port].abort();
  22.                         }
  23.                         return (pendingRequests[port] = ajax.apply(this, arguments));
  24.                 }
  25.                 return ajax.apply(this, arguments);
  26.         };
  27.     })(jQuery);
  28. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top