I'm trying to do some action:
var function some_action() {
// ...
}
But this action requires all the ajax to be finished, so I wrote this way:
$(document).one('ajaxStop', some_action);
Ok, when all pending ajax request finishes, the function would be fired.
But sometimes when I do it, there is no pending ajax requests, so the one
event do not fire in these cases!
So I'm finding a way to check if there is any ajax requests that are in progress?
Like:
if($.hasAjaxRunning()) {
$(document).one('ajaxStop', some_action);
} else {
some_action();
}
So that I can make the action guaranteed to be fired.