Skip to content Skip to sidebar Skip to footer

Ajaxstop() Doesn't Fire

This is the code that wasn't working: $(document).ajaxStop(function() { $(this).unbind('ajaxStop'); //prevent running again when other calls finish // Display everything

Solution 1:

You'll notice I was making JSONP requests. It took me forever to find this, but the answer to this issue can be found here.

From the ticket:

JSONP requests are not guaranteed to complete (because errors are not caught). jQuery 1.5 forces the global option to false in that case so that the internal ajax request counter is guaranteed to get back to zero at one point or another.

If you want all requests to fire the events, no matter what (and at the risk of the same inconsistencies 1.4.4 exhibited), you can use the following prefilter:

jQuery.ajaxPrefilter(function( options ) {
    options.global = true;
});

Case in point: http://jsfiddle.net/X4JTx/

Post a Comment for "Ajaxstop() Doesn't Fire"