Hi,
I'm new to JSON and prototype so you may need to dumb it down a bit
for me. I am using the JSON for ASP code to return a recordset in
JSON format. It is only returning one record, which is correct for the
query I am running, but the JSON for ASP class is putting the [ ] at
each end of the data resulting in an array of data with 1 member.
How can I pass this via evalJSON in prototype. I want to retrieve the
values of the JSON data and fill some form fields but can't figure out
how to access the array. That is: data as follows
[ {"name":"John","surname":"Smith"}]
how do I access the name and the surname?
var arrpeople = transport.responseText.evalJSON(true);
alert(arrpeople.name); //this line doesn't fail but It
returns 'Undefined'
Firebug shows the evalJSON has worked because I can drill down into
arrpeople... 0... name and it shows John. What is the correct syntax
to show arrpeople(0).name ?
Thanks
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Prototype & script.aculo.us" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~----------~----~----~----~------~----~------~--~---