Forum: Ruby on Rails Displaying JSON response in view

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
2eac5554aeb88694468a955a0db2b274?d=identicon&s=25 Joshua Partogi (Guest)
on 2009-02-06 00:03
(Received via mailing list)
Dear all,

I'm totally new with Ajax and Rails. How do I display JSON objects
that I get from the controller to the view. Is there any way we can
display the JSON objects directly in the DOM, or do I have to
manipulate the DOM to place the JSON objects upon successful Ajax
call? I just hate having to do the latter. Please advice.

Thank you in advance.
81b61875e41eaa58887543635d556fca?d=identicon&s=25 Frederick Cheung (Guest)
on 2009-02-06 01:02
(Received via mailing list)
On 5 Feb 2009, at 23:02, Joshua Partogi wrote:

>
> Dear all,
>
> I'm totally new with Ajax and Rails. How do I display JSON objects
> that I get from the controller to the view. Is there any way we can
> display the JSON objects directly in the DOM, or do I have to
> manipulate the DOM to place the JSON objects upon successful Ajax
> call? I just hate having to do the latter. Please advice.
>

well you could just insert the json string into the dom, but i doubt
that your users will find

{"foo": "bar"}

very informative. It's up to you to construct some appropriate way of
displaying your data.

Fred
This topic is locked and can not be replied to.