XDomainRequest在状态为200时不给出响应

时间:2012-09-18 11:06:31

标签: javascript ajax request response xdomainrequest

XDomainRequest在状态为200时没有给出响应

var httpRequest = new XDomainRequest();
httpRequest.open('POST', url, true);
httpRequest.send(xmlDocument);
alert(httpRequest.responseText);
return httpRequest;

它将响应文本设为null。 PLZ指导我失踪的地方。

1 个答案:

答案 0 :(得分:1)

尝试做:

var httpRequest = new XDomainRequest();
httpRequest.onload=function() {
    alert(httpRequest.responseText);
}
httpRequest.open('POST', url, true);
httpRequest.send(xmlDocument);