Index: ajax.js =================================================================== --- ajax.js (revision 6529) +++ ajax.js (working copy) @@ -161,6 +161,7 @@ contentType: "application/x-www-form-urlencoded", processData: true, async: true, + requestPolling: true, /* timeout: 0, data: null, @@ -369,21 +370,8 @@ // Wait for a response to come back var onreadystatechange = function(isTimeout){ - // The request was aborted, clear the interval and decrement jQuery.active - if ( xhr.readyState === 0 ) { - if ( ival ) { - // clear poll interval - clearInterval( ival ); - ival = null; - - // Handle the global AJAX counter - if ( s.global && ! --jQuery.active ) { - jQuery.event.trigger( "ajaxStop" ); - } - } - - // The transfer is complete and the data is available, or the request timed out - } else if ( !requestDone && xhr && (xhr.readyState === 4 || isTimeout === "timeout") ) { + // Process request complete, request timeout and request abort events + if ( !requestDone && xhr && (xhr.readyState == 4 || xhr.readyState == 0 || isTimeout == "timeout") ) { requestDone = true; // clear poll interval @@ -435,9 +423,15 @@ }; if ( s.async ) { - // don't attach the handler to the request, just poll it instead - var ival = setInterval(onreadystatechange, 13); - + + if( s.requestPolling) { + // don't attach the handler to the request, just poll it instead + var ival = setInterval(onreadystatechange, 13); + + } else { + xhr.onreadystatechange =onreadystatechange; + } + // Timeout checker if ( s.timeout > 0 ) { setTimeout(function(){