Opened 9 years ago
Closed 9 years ago
#14832 closed bug (notabug)
ajaxStop triggered later than expected
Reported by: | jasonkostempski | Owned by: | |
---|---|---|---|
Priority: | undecided | Milestone: | None |
Component: | unfiled | Version: | 2.1.0 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
jQuery.active gets decremented and, if 0, triggers ajaxStop at the end of the 'done' function. I would expect that to happen as soon as the request is done before any callbacks are fired.
In my case I have a flag that gets toggled if there are any ajax requests active which prevents some things from happening if true. I expected that flag to be off inside my success callback function since at that point the request is technically complete but is not until after my success callback exits.
Note: See
TracTickets for help on using
tickets.
That design sounds like ill-advised coupling to me. Regardless, since the behavior has been consistent for several years, it would be a bad idea to change it now. We don't document the event order but I think it makes sense that ajaxStop follows the execution of the last active request.