was trying to show loading gif and call ajax request (which responds after huge time) and then i hide loading gif.
Below is the code :
$('.loading-gif').show();
$ajax({url:'',async:false}).done(function(){...//some operation});
$('.loading-gif').hide();
I would like to know why this is happening. Note :When i check using debug it works but the gif image stops its animating when ajax request is called. Also what is solution for me to get this resolve.
i do have few statement that i had to add after ajax call(which are to be executed if or else the ajax call is made), So i choose to go for async false( which my org also wants to hold on the request). But i didn' t know it will stop my animation and show() method of jquery( I was assuming show will be called next ajax so show will display the loading-gif and calls ajax, please correct me if i am wrong here).
Matt Strom
Software Engineer, TypeScript ninja
The
{ async: false }is probably wrong... theasync=falseoption will cause the request to be blocking. I presume you did that because the loading indicator disappeared too quickly, right? If so, it disappeared too quickly because the image needs to be hidden only after the AJAX request has returned by using the callback.$('.loading-gif').show(); $ajax({ url: url }).done(function(){ //some operation $('.loading-gif').hide(); });