Try:
{"name": "Violet", "occupation":
"character"}
Best,
Tobie
On Feb 9, 8:05 pm, shichuanr
<shichu...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
wrote:> Hi, all
>
> I am trying to use evalJSON with Ajax, but somehow it doesn''t
work.
>
> for instance, I have a php file has the following output:
> "name": "Violet", "occupation":
"character"
>
> and I have a html file with the following javascript:
> new Ajax.Request(''/some_url'', {
method:''get'', onSuccess:
> function(transport){ var json > transport.responseText.evalJSON();
} });
> alert (json.name);
>
> by right, i should get an alert box displaying ''Violet''
right?
>
> can someone help?
>
> thanks in advance. :)
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Spinoffs" group.
To post to this group, send email to
rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-spinoffs?hl=en
-~----------~----~----~----~------~----~------~--~---