Also, consider that your image might be taking a while to load. Consider
preloading the image.

  _____  

From: jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of Benjamin Sterling
Sent: Tuesday, January 08, 2008 3:34 PM
To: jquery-en@googlegroups.com
Subject: [jQuery] Re: Progress image swap


T,
Keep you head up, we have all felt that way.

What I normally do is something like:

  $("#meter").attr("src","img/meter_on.gif") // change the src tag to the
animate gif
$.ajax({

url: 'myurl',
success : function(){//do processing},
error: function(){/process error},
complete : function(){$("#meter").attr("src","img/meter_off.gif")} // this
gets called after success and error callbacks are executed 
});

Let me know if that makes sense?


On 1/8/08, Trans <[EMAIL PROTECTED]> wrote: 


Hi--

I'm pulling my hair out trying to make this work. I want to change an
image to an animated gif to indicate progress while I pull down some
files via synchronous ajax, and then switch the image back to a static 
one when finished. Everything I try fails, invariably the animated gif
doesn't become visible until all the ajax loads complete, and then of
course it gone. HEre the basic code I have at them moment:

  $("#meter").attr("src","img/meter_on.gif").show('fast', function() {
    load_stuff_with_ajax();
    $("#meter").attr("src","img/meter_off.gif").show(); 
  });

Any help will is greatly appreciated. I can;t tell you how sick I am
of reading tutorials saying how easy AJAX is when the simple things
like seem impossible to figure out.

Thanks,
T.






-- 
Benjamin Sterling
http://www.KenzoMedia.com
http://www.KenzoHosting.com
http://www.benjaminsterling.com 

Reply via email to