1

我试图在我的 jquerymobile / phonegap 应用程序中解析这个 Youtube 播放列表。但它不会返回任何结果。我做错了什么。我的代码如下

     var URL="http://gdata.youtube.com/feeds/api/playlists/PLF-N2d3bs_9gVydP2YiG61ePBANMHXFKH?v=2&alt=jsonc&callback=?&max-results=15&start-index=15";
      $.ajax({
        type: "GET",
        url: URL,
        cache: false,
        dataType:'jsonp',
        success: function(data){
           $.each(data.data.items, function(index) { 
           var myDateArray = this.updated.split("-");
           var date = 1+parseInt(myDateArray[1])+"/"+(myDateArray[2]).toString().substr(0,2)+"/"+myDateArray[0];
           var thumb = this.thumbnail.sqDefault;
           var count = this.viewCount; 
           idiam = this.id; 
           var me = this.uploader;
           var time = this.duration; 
           var title = this.title;
           var link = getAttributeByIndex(this.player, 0); 
           $('.real').append("<li   data-icon='false'><a><img src='" + thumb + "' />                  <h4>"+title+"</h4><p>" + count + " views | " + me + "</p></a></li>").listview('refresh');  
    });       
   }
   });

   // Used to get an element from an object
     function getAttributeByIndex(obj, index){
        var i = 0;
         for (var attr in obj){
       if (index === i){
        return obj[attr];
        }
     i++;
      }
       return null;
     }
4

0 回答 0