Trying to insert several images into a webpage from a JSON data provided to me. It looks like this:
"tvdb_id": 80379,
"tvrage_id": 8511,
"ended": false,
"images": {
"poster": "http://slurm.trakt.us/images/posters/34.66.jpg",
"fanart": "http://slurm.trakt.us/images/fanart/34.66.jpg",
"banner": "http://slurm.trakt.us/images/banners/34.66.jpg"
},
Here is my code:
var sTvrageId = $("<p></p>").html("<b>TV RAGE ID: </b>" + data[key].tvrage_id);
var sEnded = $("<p></p>").html("<b>Ended: </b>" + data[key].ended);
var sImages = $("<img>").html((j=0, j < data[key].images.length, j++)data[key].images[j]);
However, no matter what variation I try on syntax for the loop, it won't insert the images. How can I fix this?
images.lengthis probably0because its not an array. You have to use the names of the attributes or cycle through the properties