YUI "Get" utility to parse JSON response?

Posted by Sean on Stack Overflow See other posts from Stack Overflow or by Sean
Published on 2009-11-29T16:28:41Z Indexed on 2010/03/26 6:03 UTC
Read the original article Hit count: 341

Filed under:
|
|

The documentation page for the YUI "Get" utility says:

Get Utility is ideal for loading your own scripts or CSS progressively (lazy-loading) or for retrieving cross-domain JSON data from sources in which you have total trust.

...but doesn't have any actual examples for how to do so. Their one example doesn't actually request a JSON document from a remote server, but instead a document containing actual JavaScript along with the JSON data.

I'm just interested in the JSON response from the Google Maps API HTTP (REST) interface. Because I can't do cross-site scripting with the "Connect" utility, I am trying the "Get" utility. But merely inserting some JSON data into the page isn't going to do anything, of course. I have to assign it to a variable. But how?

Also, just inserting JSON data into the page makes Firefox complain that there's a JavaScript error. And understandably! Plain ol' JSON data isn't going to parse as valid JavaScript.

Any ideas?

© Stack Overflow or respective owner

Related posts about yui

Related posts about JSON