[英]CORS preflight OPTIONS request returning error, but POST still being sent
I'm making a cross-domain request to an asmx service from my site using jQuery ajax as follows: 我正在使用jQuery ajax从我的站点向asmx服务发出跨域请求,如下所示:
$j.ajax({
url: svcURL,
type: "POST",
data: xml,
contentType: "text/xml",
dataType: "text",
success: function(d) {
alert(d);
},
error: function(a, b, c) {
alert("error");
}
});
This POST
request is preceded by a preflight OPTIONS
request which the service is not configured to deal with currently, so it returns with either a 500 (Internal Server Error)
or a 405 (Method Not Allowed)
. 此POST
请求之前是预检OPTIONS
请求,该服务当前未配置为处理该请求,因此它返回500 (Internal Server Error)
或405 (Method Not Allowed)
。
After receiving this error, I would expect the browser to then ignore the POST
request and return an error, however: 收到此错误后,我希望浏览器随后忽略POST
请求并返回错误,但是:
In Chrome & IE the POST
request is still sent (which the service is correctly configured to deal with) and a response is received. 在Chrome和IE中 ,仍然发送POST
请求(已正确配置服务以进行处理)并收到响应。
In Firefox the POST
just returns an error. 在Firefox中 , POST
仅返回错误。
Could someone explain the reason why this works in Chrome? 有人可以解释为什么该功能可以在Chrome浏览器中使用吗? I would have expected it to behave how Firefox does. 我本来希望它表现出Firefox的功能。
Thanks for any help in advance. 感谢您的任何帮助。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.