Ajax start and Stop on every page

by Faisal Khan Janjua

JavaScript

jQuery(document).ajaxStart(function () {
  jQuery('.ajaxLoader').fadeIn('fast');
});
jQuery(document).ajaxComplete(function () {
  jQuery('.ajaxLoader').fadeOut('fast');
});

/* -------------------------------------- */

function ajaxLoaderIn() {
  jQuery('.ajaxLoader').fadeIn('fast');
}
function ajaxLoaderOut() {
  setTimeout(function () {
    jQuery('.ajaxLoader').fadeOut('fast');
  }, 500);
}
jQuery(document).ajaxStart(function () {
  ajaxLoaderIn();
});
jQuery(document).ajaxComplete(function () {
  ajaxLoaderOut();
});