Eric Goodwin
2006-Feb-03 06:10 UTC
[Rails] Calling a javascript function after loading a partial with rjs
Hi, Is is possible to call a javascript function once a partial is loaded. Here''s what I am doing. I have a partial that gets updated via. an ajax call. When the partial is updated I want to call a javascript function ( enableTooltips ) which will then add tooltips to my links in the newly updated partial. Any help would be greatly appreciated. Thanks, Eric -- Eric Goodwin ericgoodwin.com
Bob Silva
2006-Feb-03 06:15 UTC
[Rails] Calling a javascript function after loading a partial withrjs
I believe the :complete option will accomplish this for you. Another method is to stick a script tag in your partial that calls the function. Haven''t used either of these, just recalling from the API docs I read so take it as a starting point for your research. Bob Silva http://www.railtie.net/> -----Original Message----- > From: rails-bounces@lists.rubyonrails.org [mailto:rails- > bounces@lists.rubyonrails.org] On Behalf Of Eric Goodwin > Sent: Thursday, February 02, 2006 10:13 PM > To: rails@lists.rubyonrails.org > Subject: [Rails] Calling a javascript function after loading a partial > withrjs > > Hi, > Is is possible to call a javascript function once a partial is loaded. > Here''s what I am doing. > I have a partial that gets updated via. an ajax call. When the partial > is updated I want to call a javascript function ( enableTooltips ) which > will then add tooltips to my links in the newly updated partial. > Any help would be greatly appreciated. > Thanks, > Eric > > -- > Eric Goodwin > ericgoodwin.com > > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails
Eric Goodwin
2006-Feb-03 06:30 UTC
[Rails] Calling a javascript function after loading a partial withrjs
Thanks for the help Bob, Putting the code in the partial works fine in Firefox, but alas IE lets up down on this one. It seems that IE doesn''t allow changing HTML tables via DOM until they are fully rendered. IE crashes with an "Operation Aborted" error. This happens in both IE 6 and the new IE 7 Beta. The :complete worked perfectly though. I should have known. It''s getting late though and my brain isn''t working like it should be. Thanks again, Eric Bob Silva wrote:>I believe the :complete option will accomplish this for you. > >Another method is to stick a script tag in your partial that calls the >function. > >Haven''t used either of these, just recalling from the API docs I read so >take it as a starting point for your research. > >Bob Silva >http://www.railtie.net/ > > > >>-----Original Message----- >>From: rails-bounces@lists.rubyonrails.org [mailto:rails- >>bounces@lists.rubyonrails.org] On Behalf Of Eric Goodwin >>Sent: Thursday, February 02, 2006 10:13 PM >>To: rails@lists.rubyonrails.org >>Subject: [Rails] Calling a javascript function after loading a partial >>withrjs >> >>Hi, >>Is is possible to call a javascript function once a partial is loaded. >>Here''s what I am doing. >>I have a partial that gets updated via. an ajax call. When the partial >>is updated I want to call a javascript function ( enableTooltips ) which >>will then add tooltips to my links in the newly updated partial. >>Any help would be greatly appreciated. >>Thanks, >>Eric >> >>-- >>Eric Goodwin >>ericgoodwin.com >> >>_______________________________________________ >>Rails mailing list >>Rails@lists.rubyonrails.org >>http://lists.rubyonrails.org/mailman/listinfo/rails >> >> > >_______________________________________________ >Rails mailing list >Rails@lists.rubyonrails.org >http://lists.rubyonrails.org/mailman/listinfo/rails > >-- Eric Goodwin ericgoodwin.com