using the following code—
<html>
<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js" type="text/javascript"></script>
<script type="text/javascript">
$(function() {
$.ajax({
type: "GET",
dataType: "jsonp",
cache: false,
url: "https://api.instagram.com/v1/media/131324529876654234_1491525?client_id=afd15cca7d664a1c964d54bac0488b93",
success: function(data) {
for (var i = 0; i < 1; i++) {
$("#pics").append("<img src='" + data.data[i].images.thumbnail.url + "'></img>");
}
}
});
});
</script>
</head>
<body>
<div id="pics"></div>
</body>
I want to get an image to show up based on the id I pass in the api. For some reason it doesn’t work. any one can tell me what im doing wrong?
thanks
There doesn’t seem to be an array anywhere in the JSON that you’re accessing.
Here is a dumbed-down version of your JSON to illustrate the point:
Here is a demo: http://jsfiddle.net/8Reu2/