Hi everyone, I am in a situation where I have a ruby var x and I like to pass that var x to javascript array at index x Is there a way of doing such a thing? -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Lalala Liliil wrote:> Hi everyone, > I am in a situation where I have a ruby var x and I like to pass that > var x to javascript array at index x > Is there a way of doing such a thing?Is this supposed to happen when the page loads or during some sort of browser event when the user is viewing the page? If it''s on page load you can just write some ERb in the .rhtml file to pass the value of the ruby var into the JavaScript array. If it''s on a browser event and you want the value to be set without a page refresh you can use Ajax. -- Michael Wang --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Michael Wang wrote:> Lalala Liliil wrote: >> Hi everyone, >> I am in a situation where I have a ruby var x and I like to pass that >> var x to javascript array at index x >> Is there a way of doing such a thing? > > Is this supposed to happen when the page loads or during some sort of > browser event when the user is viewing the page? If it''s on page load > you can just write some ERb in the .rhtml file to pass the value of the > ruby var into the JavaScript array. If it''s on a browser event and you > want the value to be set without a page refresh you can use Ajax. > > > -- > Michael Wangthank you -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---