Hey Is there a ajax method that triggers when the page is fully loaded? I want to be able to specify which div to update, something like this: <%= on_page_loaded( :update => "generatedimage", :url => { :action => :generateimage }) %> What I''m trying to do is load a page with a animated gif image saying "custom graphics is being generated...". When this page has finished loading, I want to call a remote method that generates a custom image and returns it, replacing the first image. The generation of the custom image takes a few seconds, thats why I want to display the first animated gif. (I want the replacement of the image to be done using ajax) Can this be done? Thank you guys for this awesome forum :) //Daniel -- Posted via http://www.ruby-forum.com/.
Sébastien Grosjean
2006-Apr-06 23:15 UTC
[Rails] Re: ajax question, not so basic I guess...
Daniel <big@...> writes:> Is there a ajax method that triggers when the page is fully loaded? > > I want to be able to specify which div to update, something like this: > > <%= on_page_loaded( > :update => "generatedimage", > :url => { :action => :generateimage }) > %> >...> (I want the replacement of the image to be done using ajax)I guess a call to window.onload from javascript may solve your problem.
=?utf-8?b?U8OpYmFzdGllbg==?= Grosjean wrote:> Daniel <big@...> writes: > >> Is there a ajax method that triggers when the page is fully loaded? >> >> I want to be able to specify which div to update, something like this: >> >> <%= on_page_loaded( >> :update => "generatedimage", >> :url => { :action => :generateimage }) >> %> >> > ... >> (I want the replacement of the image to be done using ajax) > > > I guess a call to window.onload from javascript may solve your problem.Is it really possible to call a remote method from a javascript? Can anybody point me in the right direction? This cant be that hard... how do you usually solve these kind of problems? //Daniel -- Posted via http://www.ruby-forum.com/.
Ok, i take it ajax cant do the magic for me... I think I''ll go with a pure javascript solution like this http://siter.com.au/dmitry/images.html //Daniel -- Posted via http://www.ruby-forum.com/.
Daniel wrote:> =?utf-8?b?U8OpYmFzdGllbg==?= Grosjean wrote: >>I guess a call to window.onload from javascript may solve your problem. > > > Is it really possible to call a remote method from a javascript?That would be the point :-)> This cant be that hard... how do you usually solve these kind of > problems?window.onload=function(){ <%= remote_function(:update => ''generatedimage'', :url => {:action => ''generateimage''}) %>; }; Something like that, anyway... -- Alex