I want to build a function that fires with every ajax request. Like showing "loading...". I am using Jquery is that possible?
jQuery.active
contains the number of active jQuery AJAX connections. However, you'd have to constantly poll that var in order to have an event fired in the advent of a new connection.
Anyway, why would you be using this for a "loading" indicator? Just set the indicator whenever you do the request.
Yes, this is totally possible. Start with the global ajax handlers here http://api.jquery.com/category/ajax/global-ajax-event-handlers/ .ajaxStart() and .ajaxStop() events are the most likely candidate to show your status 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