Hi,
How can we use an array created in Ruby in Java script ?
Regards,
Prashant
Hi,
How can we use an array created in Ruby in Java script ?
Regards,
Prashant
(2010/01/18 15:24), THAKUR PRASHANT SINGH wrote:
Hi,
How can we use an array created in Ruby in Java script ?
Regards,
Prashant
Hi.
JSON library makes it possible.
For example:
http://flori.github.com/json/
Usage:
puts %w!foo bar baz!.to_json
I tried using json but I am doing some mistake because of which I am not
able to get value properly
I have such code in ruby file
@files = Dir.glob("*.txt").to_json
In view file
var files= (’<%= h @kmlfiles -%>’);
When I see the alert I get a complete string containing list of all
files
When I run this alert I see one character printed at a time iso a single
file name.
for(i=0;i<3;i++)
{
alert(files[i]);
}
I am making some mistake in using json but could not figure out what.
Can you please help ?
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