Jquery 使用ajax获取youtube oembed json
我试图用ajax获取youtube链接的嵌入代码,但它总是返回错误 我在Jquery中使用ajaxJquery 使用ajax获取youtube oembed json,jquery,ajax,json,youtube,oembed,Jquery,Ajax,Json,Youtube,Oembed,我试图用ajax获取youtube链接的嵌入代码,但它总是返回错误 我在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)
$.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.");
}
});
试试下面的方法
$.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.");
}
});
试试这个:-
现场演示:-
试试这个:-
现场演示:-
使用它…你会得到你的回应…仅此而已…我不知道为什么它真的很有趣!!!谢谢关于YQL的提示:)@BahadırÖzkan,看:使用它…你会得到你的回应…仅此而已…我不知道为什么这真的很有趣!!!谢谢关于YQL的提示:)@BahadırÖzkan,见: