用ajax获取youtube oembed json

我试着用ajax获取youtube链接的oembed代码,但它总是返回错误我正在使用带有Jquery的ajax

$.ajax({ method: 'GET', dataType :'json', url:'http://www.youtube.com/oembed?url=http://www.youtube.com/watch?v=wbp-3BJWsU8&format=json', success:function(data){ alert(data); }, error: function(error) { alert(error); } }); 

尝试以下方法

  $.ajax({ url: 'http://query.yahooapis.com/v1/public/yql', data: { q: "select * from json where url ='http://www.youtube.com/oembed?url=http://www.youtube.com/watch?v=wbp-3BJWsU8&format=json'", format: "json" }, dataType: "jsonp", success: function (data) { alert(JSON.stringify(data)); }, error: function (result) { alert("Sorry no data found."); } }); 

试试这个 :-

现场演示: –

http://jsfiddle.net/YFtvU/8/

 $.ajax({ url: 'http://query.yahooapis.com/v1/public/yql', data: { q: "select * from json where url ='http://www.youtube.com/oembed?url=http://www.youtube.com/watch?v=wbp-3BJWsU8&format=json'", format: "json" }, dataType: "jsonp", success: function (data) { alert(JSON.stringify(data)); }, error: function (result) { alert("Sorry no data found."); } });