Is it possible to show the \"Loading..\" animation only if the ajax call takes more than say, one second? Some of my ajax calls are pretty fast but I still see the loading i
You could use a setTimeout().
setTimeout()
var loadingTimeout; $('#loading').hide() .ajaxStart(function() { var element = $(this); loadingTimeout = setTimeout(function() { element.show(); }, 1e3); }) .ajaxStop(function() { clearTimeout(loadingTimeout); $(this).hide(); });