I would like to place a \"please wait, loading\" spinning circle animation on my site. How should I accomplish this using jQuery?
Along with what Jonathan and Samir suggested (both excellent answers btw!), jQuery has some built in events that it'll fire for you when making an ajax request.
There's the ajaxStart event
Show a loading message whenever an AJAX request starts (and none is already active).
...and it's brother, the ajaxStop event
Attach a function to be executed whenever all AJAX requests have ended. This is an Ajax Event.
Together, they make a fine way to show a progress message when any ajax activity is happening anywhere on the page.
HTML:
Please Wait
Script:
$(document).ajaxStart(function(){
$('#loading').show();
}).ajaxStop(function(){
$('#loading').hide();
});