I'm trying to retrieve album artwork from the Last.FM API using JSON and jQuery Ajax, but I'm having trouble accessing the data structure, which looks like:
"image":[
{
"#text":"http:\/\/userserve-ak.last.fm\/serve\/34s\/82993237.png",
"size":"small"
},
{
"#text":"http:\/\/userserve-ak.last.fm\/serve\/64s\/82993237.png",
"size":"medium"
},
{
"#text":"http:\/\/userserve-ak.last.fm\/serve\/174s\/82993237.png",
"size":"large"
},
{
"#text":"http:\/\/userserve-ak.last.fm\/serve\/300x300\/82993237.png",
"size":"extralarge"
},
{
"#text":"http:\/\/userserve-ak.last.fm\/serve\/_\/82993237\/Jake+Bugg.png",
"size":"mega"
}
],
Full URL: http://lab.starchcreative.co/zapp/albumartproxy.php?artist=Jake%20Bugg&album=Jake%20Bugg
This data is nested inside album
as well, so I tried to do this to access the artwork URL for mega: albumArtURL = data.album.image.#text[4];
This returned an error as I had #
in the item. So I just tried albumArtURL = data.album.image.text[4];
to no avail.
Can anyone help with what I'm doing wrong?