Skip to main content

Bug Tracker

Side navigation

#8338 closed bug (wontfix)

Opened February 21, 2011 01:20PM UTC

Closed February 21, 2011 02:15PM UTC

Last modified March 14, 2012 11:50AM UTC

ajaxStart and ajaxStop events not working for 1.5.0

Reported by: metin.goktay@gmail.com Owned by:
Priority: low Milestone: 1.next
Component: ajax Version: 1.5
Keywords: Cc:
Blocked by: Blocking:
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

Attachments (0)
Change History (3)

Changed February 21, 2011 02:15PM UTC by jaubourg comment:1

resolution: → wontfix
status: newclosed

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/

Changed February 21, 2011 02:40PM UTC by jitter comment:2

component: unfiledajax
priority: undecidedlow

Changed July 25, 2011 02:11PM UTC by leods92 comment:3

@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.