gpt4 book ai didi

Javascript AJAX 调用响应状态 200 OK 但调用了错误回调

转载 作者:行者123 更新时间:2023-11-28 17:41:35 25 4
gpt4 key购买 nike

我正在调用此电话:

$.ajax({
type: 'GET',
cache: false,
timeout: 20000,
async: true,
url: "http://search.carrotsearch.com/carrot2-webapp/search",
dataType: 'text',
data: {
query:'london',
results:'100',
source:'etools',
algorithm:'lingo3g',
view:'folders',
skin:'fancy-compact',
type:'DOCUMENTS'
},
success: function(msg) {
debugger;
},
error: function(err,textStatus, errorThrown){
debugger;
}
});

`

Fiddler 显示响应 OK 200 并返回正确的 gzip 压缩内容。但在浏览器调试器中,错误回调被调用:

enter image description here

最佳答案

问题是CORShttp://search.carrotsearch.com/ 不允许 AJAX 请求。

在控制台中查找以下错误。

No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:XXX' is therefore not allowed access.

可能是我的 localhost 未在 http://search.carrotsearch.com/ 服务器上列出。但是,我想在你的情况下这也是问题所在。

关于Javascript AJAX 调用响应状态 200 OK 但调用了错误回调,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47813783/

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