Prev: Can't install gems (Windows)
Next: ruby for TT
From: THAKUR PRASHANT SINGH on 18 Jan 2010 01:24 Hi, How can we use an array created in Ruby in Java script ? Regards, Prashant
From: 竹山 雄也 on 18 Jan 2010 03:08 (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
From: THAKUR PRASHANT SINGH on 18 Jan 2010 04:14 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 ? -----Original Message----- From: 竹山 éä¹ [mailto:sign.of.the.wolf.pentagram(a)gmail.com] Sent: Monday, January 18, 2010 1:38 PM To: ruby-talk ML Subject: Re: Ruby Array to Java Script Array (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
|
Pages: 1 Prev: Can't install gems (Windows) Next: ruby for TT |