Ok, so say you have a page, and when it loads, it runs everything in application.js. Here, there is some code in between: Event.observe(window, ''load'', function(){ // Code goes here. }) Does anyone know, how you could get the same code to run, after responding to certain ajax calls? For example, someone clicks on one of the link_to_remote links on the page, a call is made, and the js code in application.js is run again. Is this possible? --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
On 31 Oct 2007, at 23:45, Matthew Swasey wrote:> > Ok, so say you have a page, and when it loads, it runs everything in > application.js. > > Here, there is some code in between: > Event.observe(window, ''load'', function(){ > > // Code goes here. > > }) > > Does anyone know, how you could get the same code to run, after > responding to certain ajax calls? > > For example, someone clicks on one of the link_to_remote links on the > page, a call is made, and the js code in application.js is run again.Well you''ve got a bunch of callbacks with link_to_remote (:complete, ;success, :failure etc...) Will those do? Fred
That''s exactly what I needed! *Smacks head* Thank you. On Oct 31, 2007, at 9:33 PM, Frederick Cheung wrote:> > On 31 Oct 2007, at 23:45, Matthew Swasey wrote: > >> >> Ok, so say you have a page, and when it loads, it runs everything in >> application.js. >> >> Here, there is some code in between: >> Event.observe(window, ''load'', function(){ >> >> // Code goes here. >> >> }) >> >> Does anyone know, how you could get the same code to run, after >> responding to certain ajax calls? >> >> For example, someone clicks on one of the link_to_remote links on the >> page, a call is made, and the js code in application.js is run again. > > Well you''ve got a bunch of callbacks with link_to_remote > (:complete, ;success, :failure etc...) Will those do? > > Fred--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---