YoniGeek
YoniGeek

Reputation: 4093

problems with instagram API and jquery: can't show items?

What am I doing wrong in this code? Thanks for ry time!

This is the code in action http://jsbin.com/aMiQEsA/1/

HTML

<body>
      <div id="pics" class=""></div>

</body>

JS

(function(){

     $.ajax({
        type: "GET",
        dataType: "jsonp",
        cache: false,
        url: "https://api.instagram.com/v1/tags/spain/media/recent?client_id=c1302f417cda4e09968eaec958fe0ae2",
        success: function(data) {
            for (var i = 0; i < 15; i++) {

                $("#pics").append("<img src=" + data.data[i].images.thumbnail.url+ "/>");
            }
           // console.log(data.data);
        }
    });

Upvotes: 0

Views: 981

Answers (1)

Hackerman
Hackerman

Reputation: 12305

It's just a problem with the "/" character...remove it or add an extra space like this:

(function(){


         $.ajax({
            type: "GET",
            dataType: "jsonp",
            cache: false,
            url: "https://api.instagram.com/v1/tags/malmoefestival/media/recent?client_id=c1302f417cda4e09968eaec958fe0ae2",
            success: function(data) {

                for (var i = 0; i < 15; i++) {

                    $("#pics").append("<img src=" + data.data[i].images.thumbnail.url+ " />");
                }

            }
        });




    })();

Working here: http://jsbin.com/UcUyuQo/1/

Upvotes: 1

Related Questions