Youtube API -为视频id查询JSON会加载空的嵌入式iframe



我把它们都放在这里:http://jsfiddle.net/uJ3h7/

但是我将在这里重新发布标记:

$(document).ready(function(){
$.getJSON("http://gdata.youtube.com/feeds/api/users/MisterAngelMarino/favorites?v=2&alt=jsonc&max-results=1",function(json){
$.each(json.data, function(i,video){
var source = video.id
$("#video").append('<iframe width="560" height="349" src="http://www.youtube.com/embed/'+ source + '?html5=1&theme=dark&showinfo=0&modestbranding=1&controls=0" allowfullscreen></iframe>');    
    });
});
});

<div id="video"></div>

你知道我做了什么吗?

应该可以:

http://jsfiddle.net/pKZPP/

最新更新