I needing some help here if possible. I have a JSON file and I'm trying to get just 1 result from the image files and specify which image by a number e. g. the first one - is this possible. I have tried lots of different [1] ways but I'm clearly doing something wrong here.
Here's my attempt: http://jsfiddle.net/garrycalliopix/Z233A/
$(function(){
$.get('http://sunrise.bluechipholidays.co.uk/webservices/property/images/apikey/demo/propertycode/zinc52/propertycode/proch', function(data){
var $imagetest = $('#imagetest');
$(data.data).each(function(i, x){
$(x.images).each(function(j, k){
var $img = $('<img></img>');
$img.attr[1]; //i want the 2nd image returned
$img.attr('width', '150px');
$img.attr('height', '75px');
$img.attr("src", k.url).appendTo("#imagetest");
});
});
});
});
[0]
is the image number returned not the count of images: [2]
would be the 3rd image.