Hi,
I need to pass in an array to JS function, which initializes its local
variables.
I have always called JS functions on events like onclick and such.
How do i invoke JS function directly without such events?
Regards,
Sandeep G
Hi,
I need to pass in an array to JS function, which initializes its local
variables.
I have always called JS functions on events like onclick and such.
How do i invoke JS function directly without such events?
Regards,
Sandeep G
You need to pass an array (in which language) to Javascript?
Do you want to pass a Ruby array in? Or a Javascript array?
Where do you want to invoke the Javascript from? Javascript is usually
(as you say) event based.
Julian.
Learn Ruby on Rails! CHECK OUT THE FREE VIDS (LIMITED TIME) NEW VIDEO
(#2) OUT NOW!
http://sensei.zenunit.com/
I need to pass in Ruby array or hash to JS.
I am trying to pass this array into JS (Google maps).
Julian L. wrote:
You need to pass an array (in which language) to Javascript?
Do you want to pass a Ruby array in? Or a Javascript array?
Where do you want to invoke the Javascript from? Javascript is usually
(as you say) event based.Julian.
Learn Ruby on Rails! CHECK OUT THE FREE VIDS (LIMITED TIME) NEW VIDEO
(#2) OUT NOW!
http://sensei.zenunit.com/
Thanks Scott!
Had I known this earlier, I wud have saved nearly 6 hours doing hash
conversions into JS multidimensional arrays!
Anyways, it wil save my time henceforth
Regards,
Sandeep G
Use the .to_json method on the array or hash
ex.
[“first”, “second”, “thrid”].to_json out puts “[“first”, “second”,
“third”]”
in your view you do something like this
On Apr 3, 4:25 am, Sandeep G. <rails-mailing-l…@andreas-
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.
Sponsor our Newsletter | Privacy Policy | Terms of Service | Remote Ruby Jobs