Loading animation doesn't show up until after ajax call completes in Safari/Chrome

后端 未结 2 770
执念已碎
执念已碎 2021-01-24 12:37

I\'ve run into a problem that I haven\'t been able to find a solution to yet.

I\'m creating a resource booking application which uses AJAX to process information given b

2条回答
  •  醉酒成梦
    2021-01-24 13:01

    Its an old thread, but just today i had similar problem. Maybe it will help someone :).

    I've had a similar problem in IE - i have my omy own loading type div which i show before ajax request and hide it after the data is loaded. My div was shown only for a little while (it just flickered) after the data was already loaded.

    Something like this:

    document.getElementById('pnLoaderPanel').style.display = 'block';
    Task.Refresh(); //method that calls ajax
    document.getElementById('pnLoaderPanel').style.display = 'none';
    

    So I've noticed that if I put alert right after showing the div, my div is visible. I guess IE somehow did not refresh correctly so what i did was this and now its working perfectly:

    document.getElementById('pnLoaderPanel').style.display = 'block';
    setTimeout(Task.Refresh(), 1); //method that calls ajax
    document.getElementById('pnLoaderPanel').style.display = 'none';
    

提交回复
热议问题