Hi Ed,
Definitely give JSON a look if you haven''t already. That''s
pretty much
what it''s made for.
In the action that your JS is calling, use this render option:
render :json => your_data.to_json
Or use that in a respond_to block.
There''s also a little bit on returning JSON here:
http://api.rubyonrails.com/classes/ActionController/Base.html
- Doug
On Oct 15, 6:23 am, Ed Jones
<ed.jo...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
wrote:> Hi and thanks!
>
> I think this should be simple: I need to initialize and then ajax
> update a Javascript array; taking the data from a rails model. I wrote
> an iterator that created a string--which looked just like my working
> test array, but then that didn''t seem to work out for writing it
to
> the page.
>
> How is this done?
> Thanks,
> Ed
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---