View Single Post
Old 03-10-2008, 03:22 PM   #27 (permalink)
bdl
Senior Contributor
 
Join Date: May 2002
Location: vta.ca.usa
Posts: 555
bdl is on a distinguished road
XMLHttpRequest is named, well, for the ability to retrieve XML via a web service (afaik). But you can obviously transfer plain text, which is what JSON is at that point. It's just text until your JS code 'objectifies it'.

Take a look at the XHR API. Note there are two native response mechanisms, responseText and responseXML. If you want to use plain old XHR code, you'll return the JSON string with the former of those two and then use one of the two methods I outlined in an earlier post.

Otherwise, if you're using a JS framework like jQuery (which I'm fond of) or prototype, they both offer methods to actually take JSON and handle it so the object comes out the other end.
__________________
bdl is offline   Reply With Quote