Forum Moderators: open
my_data={
"seeThise": {
"xmlns:fo": "http://www.w3.org/1999/XSL/Format",
"xmlns:inlineData": "Lookup",
"CatAtts": {
"price": "Price",
"m": "342",
"acceltra": "456",
"tps": "324",
"seass": "456",
"emmits": "345",
"inse": "456",
"wr": "435",
"torate": "435"
},
"Range": {
"SmallFamily": {
"text": "Small Family",
"firstOne": {
"ytru": "bfre",
"tre": "345",
"uytr": "333",
"price": "10815",
"seder": "0",
"back": "45",
"discount": "3555"
}
"Big":{
"attr": "one",
"attr23": "ist",
"fred": "ew3",
"price": "243547"
}
"small":{
"gr": "rtg",
"re4": "ytr5",
"price": "rhfhy7",
"tye": "fdfgd"
}
"otheratt":{
"tresta": "ytr6",
"bastr": "rte",
"price": "32456"
}
}
}
}
}
<div class="myThumbnails">
<a href="javascript:void(0)"><img src="first.png" alt=""></a>
</div>
<div class="row">
<a href="javascript:void(0)"><img src="second.png" alt=""></a>
</div>
<div class="row">
<a href="javascript:void(0)"><img src="third.png" alt=""></a>
</div>
<div class="row">
<a href="javascript:void(0)"><img src="fourth.png" alt=""></a>
</div>
<div class="row">
<a href="javascript:void(0)"><img src="fifth.png" alt=""></a>
</div>
<div class="row">
<a href="javascript:void(0)"><img src="sixth.png" alt=""></a>
</div>
<div class="row">
<a href="javascript:void(0)"><img src="seventh.png" alt=""></a>
</div>
</div>
var thumbNo = 1;
var car=cars_data.haveAlook.TheThumbnails;
$(".vehicle_row a").each(function(){
$(this).html('<img src="/comparetherange/images/' +
+ car['thumb'+thumbNo]
+ '" alt="">');
thumbNo++;
});
but in the html neither the <a> nor the actual image have an id
var priceMap = {
".myThumbnails img": my_data.Range.SmallFamily.firstOne.price,
".row:nth-child(1) img": my_data.Range.SmallFamily.Big.price,
".row:nth-child(2) img": my_data.Range.SmallFamily.small.price,
".row:nth-child(3) img": my_data.Range.SmallFamily.otheratt.price
};
$.each(priceMap, function(key, value) {
$(key).css("left", value);
});
var priceMap = {
".myThumbnails img": my_data.Range.SmallFamily.firstOne.price,
".row:nth-child(1) img": my_data.Range.SmallFamily.Big.price,
".row:nth-child(2) img": my_data.Range.SmallFamily.small.price,
".row:nth-child(3) img": my_data.Range.SmallFamily.otheratt.price
};