Page is a not externally linkable
- Code, Content, and Presentation
-- JavaScript and AJAX
---- get variables from different objects in json


daveVk - 3:52 am on Aug 4, 2012 (gmt 0)


As there is no simple pattern, the map option is probably the better option.

To fit in with existing code

var thumbNo = 1;
var map = [my_data.Range.SmallFamily.firstOne.price, ....
var car=cars_data.haveAlook.TheThumbnails;
$(".vehicle_row a").each(function(){
var price = map[thumbNo-1];
$(this).html('<img src="/comparetherange/images/' +
+ car['thumb'+thumbNo]
+ '" alt="">');
thumbNo++;
});

The use (misuse?) of an 'a' tag like
<a class="SmallFamily firstOne" ...
is also possible


Thread source:: http://www.webmasterworld.com/javascript/4480672.htm
Brought to you by WebmasterWorld: http://www.webmasterworld.com