Bug Tracker

Ticket #8338 (closed bug: wontfix)

Opened 4 years ago

Last modified 3 years ago

ajaxStart and ajaxStop events not working for 1.5.0

Reported by: metin.goktay@… Owned by:
Priority: low Milestone: 1.next
Component: ajax Version: 1.5
Keywords: Cc:
Blocking: Blocked by:

Description

  • Affected Version: 1.5.0
  • Browser: Firefox 3.6.13
  • Mozilla/5.0 (Windows; U; Windows NT 6.1; de; rv:1.9.2.13) Gecko/20101203 Firefox/3.6.13 ( .NET CLR 3.5.30729; .NET4.0C)
  • Operating System: Windows 7

Hi... Given the following test case  http://jsfiddle.net/N3nAe/

using global ajaxStart+ajaxStop event handlers works perfectly fine with jQuery 1.4.4.

Expected Result: Alert dialogs should popup for ajaxStart and ajaxStop events.

When switching to jQuery 1.5.0 the same handlers are not processed any longer.

Am I missing here something essential ?

Regards Metin

Change History

comment:1 Changed 4 years ago by jaubourg

  • Status changed from new to closed
  • Resolution set to wontfix

This is because you're doing a JSONP request.

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/

comment:2 Changed 4 years ago by jitter

  • Priority changed from undecided to low
  • Component changed from unfiled to ajax

comment:3 Changed 3 years ago by leods92

@jaubourg or another expert Could you point out exactly what are the inconsistencies? I need to monitor when some JSONP calls start/end and the easier way would be using ajaxStart() and ajaxStop(). However, I'm afraid something bad might happen as you said and therefore I'd like to know what risk I'll run if decide to use the prefilter.

Thank you in advance, Leonardo.

Note: See TracTickets for help on using tickets.