[英]XMLHttpRequest status is 0
I am using window.XMLHttpRequest
. 我正在使用
window.XMLHttpRequest
。 The line commands are below. 行命令如下。
The problem is that it is returning status = 0
. 问题是它返回
status = 0
。 I checked the url but it is right. 我检查了网址,但它是正确的。 What am I doing wrong?
我究竟做错了什么?
var url = "http://177.55.99.146:8080/autenticacao/autentica?arquivo=" + file;
req.open("Get", url, true);
req.send(null);
Most of the time this is caused by a cross-domain request (I assume your request is cross-domain since you specified the full url). 大多数情况下,这是由跨域请求引起的(由于您指定了完整的网址,因此我认为您的请求是跨域的)。 Did you use the
Access-Control-Allow-Origin
header at http://177.55.99.146:8080/autenticacao/autentica ? 您是否在http://177.55.99.146:8080/autenticacao/autentica中使用了
Access-Control-Allow-Origin
标头?
Like this: 像这样:
<?php
header("Access-Control-Allow-Origin: http://www.allowed-domain.com");
?>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.