开发者

How to load JSONP data in IE?

The following works perfectly for FF, Chrome and Safari but IE rejects it.

$(function() {

  var access_token = location.hash.split('=')[1];
  $.ajax({
    type: "GET",
    dataType: "jsonp",
    cache: false,
    url: "https://api.instagram.com/v1/users/1055710/media/recent
           /?access_token=1055710.c0af960.953163eb1bf44607a94ad482e33b5b68",
    success: function(data) {        
      for (var i = 0; i < 6; i++) {
        $(".instagram").append($("<div class='instagram-placeholder'>")
                       .append($("<a target='_blank'>")
                         .attr("href", data.data[i].link)
       开发者_如何学C                .append($("<img class='instagram-image'>")
                         .attr("src", data.data[i].images.thumbnail.url))))   
      }     
    }
  });
});

How can I make it work in IE?


$(".instagram").append("<div class='instagram-placeholder'><a target='_blank' href='" + data.data[i].link +"'><img class='instagram-image' src='" + data.data[i].images.thumbnail.url +"' /></a></div>");

Use this inside your for loop and you will have the element list show in IE as well. Looks like IE don't like the long chaning or don't add the element propperly when chaning.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜