I’m having an issue pulling some images out of a json array.
here is my code
for (var n = 0; n < detail.photos.length; n++) {
var photos = detail.photos[n]
var photo_img = $("<img />", {
"src": photos
});
$("#Gallery").append("<br />" + photo_img)
}
what this code for my imageloop is outputting is [object, OBJECT] for each image.
I tried adding an alert(photos); and what it does is give me an alertbox with the source for each image. I can’t figure out how to get the images to display propery.
Ah the solution as pointed out below is that you can’t use concatenation with .append()
you cant use concatenation in append.
cuz then you will be adding string to an object which doesnt make any sence .
it should be like this
edit :
sorry i didnt notice that detail points to the hotel object