How can I know the number of active ajax requests using jQuery?
I understood that it jQuery.active
gave that value, but it is not working.
At one point in an app, I fire a custom event with jQuery:
$('body').trigger('association:change');
Several processes are waiting for this event, and each one performs an ajax request on its own, which can result in several simultaneous requests. To indicate to the user that the system is carrying out operations, I show an animation of the "loading" type. When the last of the requests finishes, you should hide this animation. Until now, I believed that with
if ($.active < 1) {
$('.loading').hide();
}
could get it. Is there any way to know the number of unfinished ajax requests with jQuery?