Display loading progress bar when loading content into edges
1 answer
You can bind to events ajaxStart
and ajaxStop
global (ajax) like this:
$("#loading").bind("ajaxStart", function(){
$(this).fadeIn("slow");
}).bind("ajaxStop", function(){
$(this).fadeOut("slow");
});
Assuming loading
is the id of your loading indicator div / span.
If you want a prettier solution, take a look at the amazing blockUI plugin. Equivalent to the above blockUI usage:
$().ajaxStart($.blockUI) .ajaxStop($.unblockUI);
+4
source to share