Youtube API - Querying JSON for a video id loads empty embedded iframe
I put it all here: http://jsfiddle.net/uJ3h7/
But I'll repost the mark-up here:
$(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>
Any ideas what I borked?
This should work:
http://jsfiddle.net/pKZPP/
精彩评论