Friday, 15 April 2011

javascript - JSON Jquery Array Trouble -



javascript - JSON Jquery Array Trouble -

how to, value, editions, price, average?

my non working code:

.append(th.clone().text(value.editions[0].price[1].average))

the json layout:

{ "name": "about face", "id": "about-face", "url": "https://api.deckbrew.com/mtg/cards/about-face", "store_url": "http://store.tcgplayer.com/magic/urzas-legacy/about-face", "types": [ "instant" ], "colors": [ "red" ], "cmc": 1, "cost": "{r}", "text": "switch target creature's powerfulness , toughness until end of turn.", "formats": { "commander": "legal", "legacy": "legal", "vintage": "legal" }, "editions": [ { "set": "urza's legacy", "price": { "low": 89, "average": 154, "high": 198 }, "url": "https://api.deckbrew.com/mtg/cards?multiverseid=12414", } ] }

my fiddle can found here:

http://jsfiddle.net/w2qhz/13/

you should use

.append(th.clone().text(value.editions[0].price.average))

remove [0] price, since cost object not array.

javascript jquery ajax json

No comments:

Post a Comment