Loading animation doesn't show up until after ajax call completes

前端 未结 5 1936
轮回少年
轮回少年 2020-12-03 06:20

Possible duplicate: Same problem (unresolved)

I show loading DOM before the Ajax call and after the Ajax call, I hide it. For some reason, the loading image appears

5条回答
  •  庸人自扰
    2020-12-03 06:54

    This could be another way.

    var $ani = $('#loading-popup').hide();
    $(document)
      .ajaxStart(function () {
        $ani.show();
      })
      .ajaxStop(function () {
        $ani.hide();
      });
    

提交回复
热议问题