2

Look this code:

$('#loader').show();
$.post( '/action.php', function( data ) {  
// do anything with data
$('#loader').hide(); 
}  );

The loader DIV has a GIF image simulating loading state, This code works well but the GIF stops when is waiting the data (post called) ...

I want the gif moves ever independently of the other codes in execution.. I hope you understand my problem..

CRISHK Corporation
  • 2,948
  • 6
  • 37
  • 52
  • what browser? any? I've seen such behaviour with IE, however ajaxStart, ajaxStop and ajaxError work fine for me. – dmitko Sep 16 '10 at 06:13
  • Duplicate of: - http://stackoverflow.com/questions/191413/why-does-my-spinner-gif-stop-while-jquery-ajax-call-is-running - http://stackoverflow.com/questions/780560/animated-gif-in-ie-stopping Both contain workarounds. – Jim Liddell Apr 05 '11 at 13:14

1 Answers1

2

I believe you want the behavior listed in the example on the jQuery documentation website.

jQuery:ajaxStart

You can hide the image with the ajaxStop event handler.

T.P.
  • 2,975
  • 1
  • 21
  • 20