After all ajax calls loading stop

Fancybox loading with ajax call

var loading = $('#loading');
$.ajaxSetup({
    cache: false,
    beforeSend: function (jqXHR, settings) {
        //if (!loading.show()) {
            //loading.show();
        //}
        $.fancybox.showLoading();
    },
    complete: function () {
        //$("#loading").hide();
        //$.fancybox.hideLoading();
    },
    success: function () { //$("#loading").hide(); 
        //$.fancybox.hideLoading();
    }
});
// after all ajax calls function
$(document).ajaxStop(function(){
  //loading.hide();
  $.fancybox.hideLoading();
  console.log("All AJAX requests completed");
});
After all ajax calls loading stop After all ajax calls loading stop Reviewed by Bhaumik Patel on 7:51 PM Rating: 5