Side navigation
#4777 closed bug (fixed)
Opened June 17, 2009 03:30PM UTC
Closed June 13, 2010 02:59AM UTC
Last modified March 15, 2012 03:37PM UTC
ajaxStop and ajaxStart not working
Reported by: | scarlac | Owned by: | |
---|---|---|---|
Priority: | major | Milestone: | 1.4 |
Component: | unfiled | Version: | 1.3.2 |
Keywords: | loader, ajax, jsonp, ajaxstart, ajaxstop | Cc: | |
Blocked by: | Blocking: |
Description
When using jsonp, jQuery.active is decremented twice due to the checks being made.
The reason perhaps lies in that the script.onload handler is called as well as the script.onreadystatechange. both of them decrement the jQuery.active counter.
This results in ajaxStart and ajaxStop being called once and after that the jQuery.active is negative which means neither of them are called afterwards.
I am logging this everywherein jquery.js where jQuery.active is incremented/decremented:
console.log('start, '+s.global + ", " + jQuery.active); // or this: console.log('stop, '+s.global + ", " + jQuery.active);
And my output from firebug is:
start, true, -1 GET http://localhost:8000/ap(...) calling complete in jsonp style stop in complete, true, -2 calling complete in onreadystatechange generic handler stop in complete, true, -3
I am using FF 3.0 and jQuery 1.3.2.
My current workaround is to hardcode the following fix just after all the checks:
This won't fix the *real* issue here (which is that complete() is called twice) but it will work for me and perhaps others. In other words: I wouldn't suggest that as a patch...
Regards
Seph