0

This create loader but not working in properly and not spin to page or before load page loader is hide
Home page html :-

<div id="wait" style="position:absolute;top:50%;left:50%;padding:2px;"><img src='../../assets/images/icons/loader.gif'/></div>

Other Page Html:-

<div id="VivaData">
  some content
</div>

jquery:-

 $(document).ajaxStart(function(){
   console.log('start ajax');
   $("#wait").css("display", "block");
 });
 $(document).ajaxComplete(function(){
   console.log('ajax complete');
   $("#wait").css("display", "none");
 });
 $("#VivaData").load("demo_ajax_load.asp");
Shiladitya
  • 12,003
  • 15
  • 25
  • 38
Dip Girase
  • 439
  • 1
  • 7
  • 18

1 Answers1

0

Try to use jquery ajax.

start the loader when calling the ajax function and hide it when ajax is complete.

function test(){
    //start loader
    $("#wait").css("display", "block");

    //perform any ajax operation
    $.ajax({
        url: "test.html",
        context: document.body
    }).done(function() {
        //close loader
        $("#wait").css("display", "none");
    });
}
Empty Brain
  • 627
  • 8
  • 24