gpt4 book ai didi

javascript - jQuery ajax jsonp 意外标记 :

转载 作者:行者123 更新时间:2023-11-28 08:29:09 24 4
gpt4 key购买 nike

我正在尝试从第三方获取数据 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/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com