Con jQuery possiamo implementare un indicatore di caricamento per le richieste AJAX che appaia e scompaia automaticamente.
La soluzione รจ la seguente:
(function( $ ) {
$.ajaxloader = function() {
var $loader = $( "#ajax-loader" );
if( $loader.length ) {
$loader.height( $( window ).height() );
$( document ).ajaxStart(function () {
$loader.show();
});
$( document ).ajaxStop(function () {
$loader.hide();
});
}
};
$(function() {
$.ajaxloader();
});
})( jQuery );