0

This is a common issue which I found over the internet, but none of the solutions worked for me.

I have a ajax loader GIF which is working fine in mozilla firefox but its getting stuck in chrome (ie. Image is not behaving like GIF).

here is the html code snippet-

<img id="loader" src="images/loader.gif" />

 $.ajax({
         url:'/myurl',
         type:'POST', 
         data:postArg,  
         dataType:'json',
         async:false,      
         success:function(as){
                    $('#loader').hide();
         }
        });

This is the ajax code which is returning response in around 10-15 seconds so I want to implement a loader until response is returned.

This is the image - http://imgur.com/dqom3sp

Expecting someone to help. Thanks in advance.

Robin B
  • 191
  • 4
sajalsuraj
  • 860
  • 14
  • 25
  • @sajalsuraj as of jQuery 1.8, the use of async: false is deprecated. remove this line async:false, see if that helps – David May 26 '16 at 14:06

1 Answers1

1

You are making a synchronous request. That blocks your entire browser while the request is in progress. In Chrome, this also blocks rendering. That it works at all in Firefox is a fluke.

There is virtually never a reason to use async: false. You should remove that line and let your AJAX be Asynchronous.

user229044
  • 222,134
  • 40
  • 319
  • 330