I’ve got the following code that’s taking photos from a flickr feed via JSON and I’m trying to append them to a div that sits inside another div. I can get it to append all the images into one div but I would like it to append each image to a separate div.
$.getJSON("http://api.flickr.com/services/rest/?method=flickr.photosets.getPhotos&api_key=XXXMYKEYXXX&photoset_id=XXXMYSETXXX&extras=original_format&format=json&jsoncallback=?", function(data){
$.each(data.photoset.photo, function(i,item){
var photo = 'http://farm' + item.farm + '.static.flickr.com/' + item.server + '/' + item.id + '_' + item.originalsecret + '_o.jpg';
/*var longer = 'http://farm' + item.farm + '.static.flickr.com/' + item.server + '/' + item.id + '_' + item.originalsecret + '_t.jpg';*/
$('<div class="slideshow-content">').appendTo("#slideshow-holder");
$('<img/>').attr({src: photo}).appendTo(".slideshow-content");
});
});
This editor seems to delete tags so the 2 appends are "div class="slideshow-content" and an "img /" respectively. Any help would be greatly appreciated.
Or, just construct the HTML string before appending…