This is a question involving a loop that I've seen asked a lot, i just can't seem to find anything that helps my situation.
I've built a very simple app which calls the Instagram API when the user inputs a hashtag. The below displays the images and assigns the URL to the image.
for ( i = 0; i < response.data.length; i++) {
imageDisplay = response.data[i].images.low_resolution.url;
imageUrl = response.data[i].link;
$instagram.append( '<img src="' + imageDisplay + '"/>');
$('img').wrap("<a href="+ imageUrl + "></a>");
};
})
Here's where the problem is, every image sends the user through to the last url result. I need to return the result with each loop but I can't figure out how.