I want to display data from a JSON file through an Ajax request. I display every data value except the array of images. Where am I wrong? Here is the JSON:
{
"item": {
"name": "ABITO CORTO",
"details": "Maglia leggera, Collo a V, Interno semi-foderato, Logo.",
"composition": "Composizione: 94% Viscosa, 6% Elastam.",
"modelDetails": [
"La modella indossa una taglia 40",
"Misure: 86 - 60 - 90",
"Altezza modella: 178cm"
],
"images": [
"http://cdn.yoox.biz/34/34295573it_12n_f.jpg",
"http://cdn.yoox.biz/34/34295573it_12n_r.jpg",
"http://cdn.yoox.biz/34/34295573it_12n_e.jpg",
"http://cdn.yoox.biz/34/34295573it_12n_d.jpg"
]
}
}
HTML:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
</head>
<body>
<button id="driver">ONE</button>
<div class="news_details_container">
<img src="" alt="" >
</div>
</body>
</html>
SCRIPT:
$("#driver").click( function() {
$.getJSON( "assets/data/one.json", function(data) {
$.each(data, function(key, value) {
$(".news_details_container").append(value.name);
$(".news_details_container").append(value.details);
$(".news_details_container").append(value.coposition );
$(".news_details_container").append(value.modelDetails);
$(".news_details_container").append('<img src="' + value.images + '" />');
});
});
});
I'm new to Ajax+ JSON. Can anyone help me? Thanks.