Javascript XML HTTP响应问题:XML解析错误:未找到元素位置:moz nullprincipal

Javascript XML HTTP响应问题:XML解析错误:未找到元素位置:moz nullprincipal,javascript,xml,xmlhttprequest,http-post,httpresponse,Javascript,Xml,Xmlhttprequest,Http Post,Httpresponse,下面是我的Java脚本代码 //URL = http://dev.stage.com/restapi/vc/auth/sessions/login/ //parametersURL = user.login=******&user.password=****** if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safari xmlHttp=new XMLHttpRequest(); }

下面是我的Java脚本代码

//URL = http://dev.stage.com/restapi/vc/auth/sessions/login/
//parametersURL = user.login=******&user.password=******
if (window.XMLHttpRequest)
  {// code for IE7+, Firefox, Chrome, Opera, Safari
  xmlHttp=new XMLHttpRequest();
  }
else
  {// code for IE6, IE5
  xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
  }

xmlHttp.open( "POST", URL, true );
xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xmlHttp.setRequestHeader("Content-length", parametersURL.length);
xmlHttp.setRequestHeader("Connection", "close");
xmlHttp.send(parametersURL);
xmlHttp.onreadystatechange = function() {//Call a function when the state changes.
if(xmlHttp.readyState == 4 && xmlHttp.status == 200) {
        alert(xmlHttp.responseText);
        return xmlHttp.responseXML;
    }
}
在IE8中测试时,我在警报框中得到正确的响应

<response status="success"><value type="string">
uX-DjjZ2XrSB_GAfjSLTapOJvyvd2U9Y8MHsQzrvFeo.</value></response>
使用Firefox中的Poster插件,我可以得到正确的响应


请告诉我问题是什么

这是跨域问题。在IE中没有正确处理,因此它工作正常。使用jsonp进行跨域请求,效果非常好。

更改了标题,以便将来的用户很容易提出问题。如果您不喜欢,请将其还原
XML Parsing Error: no element found Location: moz-nullprincipal:{9fc08684-36c5-42b2-
b641-e9400c6e627f} Line Number 1, Column 1: