我正在尝试从第三方获取数据 http://api.bing.net/json.aspx?Appid=APPID&query=SEARCH_TERM&sources=Web&web.count=40&web.offset=41 。
所以我只是使用jsonp来获取数据。我得到了200状态代码。但是我没有得到成功的结果数据。我也尝试了回调它不起作用。
附上我的源代码:
$.ajax({
type : "GET",
url : "http://api.bing.net/json.aspx?Appid=APPID&query=SEARCH_TERM&sources=Web&web.count=40&web.offset=41",
dataType : "jsonp",
success : function(data){
console.log(data);
},
error : function(error) {
console.log(error);
}
});
控制台返回错误:
Uncaught SyntaxError: Unexpected token :
如何解决这个问题...
最佳答案
您的回复似乎有效,请尝试此操作
$.ajax({
type : "GET",
url : "http://api.bing.net/json.aspx?Appid=APPID&query=SEARCH_TERM&sources=Web&web.count=40&web.offset=41",
dataType : "json",
success : function(data){
console.log(data);
},
error : function(error) {
console.log(error);
}
});
关于javascript - jQuery ajax jsonp 意外标记 :,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22063528/