Modify ↓
Ticket #3515 (closed bug: invalid)
ajaxStop not being bubbled to 'body' element
| Reported by: | tamlyn | Owned by: | |
|---|---|---|---|
| Priority: | minor | Milestone: | 1.3 |
| Component: | ajax | Version: | 1.2.6 |
| Keywords: | Cc: | tamlyn, flesler | |
| Blocking: | Blocked by: |
Description
This code works fine
$('#content').ajaxStart(function(){
$(this).addClass('loading');
}).ajaxStop(function(){
$(this).removeClass('loading');
});
but this doesn't:
$('body').ajaxStart(function(){
$(this).addClass('loading');
}).ajaxStop(function(){
$(this).removeClass('loading');
});
When attaching the event listeners to the body element it seems ajaxStop is not being triggered because the 'loading' class is not removed.
This, on the other hand, works fine:
$('#content').ajaxStart(function(){
$('body').addClass('loading');
}).ajaxStop(function(){
$('body').removeClass('loading');
});
Change History
Please follow the bug reporting guidlines and use jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.
Note: See
TracTickets for help on using
tickets.

It works for me. Are you doing this inside a document.ready ?