我运行Firefox105.0.1并使用jQuery3.6.1-min,并且希望将数据发布到Python应用程序,监听端口5555。
我可以用chrome,edge和opera来实现这一点,但是firefox给了我一个错误。
这是我的代码:
var settings = {
"url": "http://10.10.0.55:5555/test",
"method": "POST",
"timeout": 2000,
"crossDomain": true,
"headers": {
"Content-Type": "application/json",
"Authorization": authdata
},
"data": JSON.stringify({
"data": "mydata",
}),
};
$.ajax(settings)
.done(function() {
alert( "success" );
})
.fail(function() {
alert( "error" );
})
.always(function() {
alert( "complete" );
});有什么方法可以克服firefox中的错误吗?
发布于 2022-09-25 16:29:59
这个代码没有什么问题。您可以使用http状态码来增强它,然后将得到一个错误代码0。反过来,这主要是CORS问题,只能在服务器端解决。
https://stackoverflow.com/questions/73838472
复制相似问题