Is there a way to detect via JavaScript (client side) any AJAX requests that are occurring and even get the number of requests in progress?
The reason I ask: I have a global processing indicator in an application being worked on with several developers, some of whom neglect to start and stop the indicator when making AJAX requests.
Is there a way to detect this?
I know the best way to handle it would be to trigger something with the requests and when the requests complete, but I can't control the other developers or rewrite legacy code, so I'm looking for something I can inject in with JavaScript to detect requests.
I figured it out (using jQuery):
$(document).ajaxStart(function() { /* start indicator */ });
$(document).ajaxStop(function() { /* stop indicator */ });
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With