Do you use jQuery?
If you can use:
ajaxStart and ajaxStop: http://docs.jquery.com/Ajax
For example:
$(function(){
$("#spinner").hide();
$.ajaxStart(function(){
$("#spinner").show();
});
$.ajaxStop(function(){
$("#spinner").hide();
});
});
You can customize the melody using the query counter, which increases and decreases if you have many simultaneous requests.
If you are not using jQuery, check out the jQuery source code for which ajaxStart events are actually logged in plain old javascript.
NTN Alex
source
share