jquery - How do I parse this JSON? -
I am using a book API which gives
var _OLBookInfo = {"ISBN: 234234234234234": {"BB_key": "ISBN: 234234234234234", "Preview": "NewView", "PreviewOoral": "http://openlibrary.org/b/adsfasdfa", "info_url": "http : / /openlibrary.org/b/adsfasdf "," Details ": {" Publisher ": [" W SDFsdfsted "]}}; $ How can I get access to this easily by using the callback parameter of Get ()
, for example, -> Publisher
< P> Update $ .post ("/ home / lookupbook", {query: lookuptxt.val ()}, function (data) {warning (data) ; // Proper JSN Data Warning (Data D Description. Publishers [0]); / tells, details. Publishers [0] is zero, "Jason");
You do not need to parse JSON string in JS. Just look at the $ .getJSON () method.
Example:
$ GetJSON (URL, Data, Function (Response) {Warning (Response ['ISBN: 234234234234234'] Description. Publishers [0]);});
Upgrade: My bad -
I have just seen that the JSON is not returned in your call only, but rather returns the JS file instead.
What can you do with the data returned from eval ()
$. Get ()
$ .get (URL, data, backbackback); Function funkback (data, position) {eval (data); Warning (_OLBookInfo ['ISBN: 234234234234234']. Details.publisher [0]); }
By the way, your JSON string is invalid.
You can also try $$. GetScript ():
Comments
Post a Comment