我在firefox插件中有XMLHttpRequest,如下所示:
httpRequest = new XMLHttpRequest();
httpRequest.open("POST", baseUrl + "check.php?uid=" + username, true);
httpRequest.responseType = "document";
httpRequest.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
httpRequest.setRequestHeader("Content-length", dataString.length);
httpRequest.setRequestHeader("Connection", "close");
httpRequest.onload = infoReceived;
httpRequest.send(dataString);
我在最新版本的firefox(14.0.1)上运行得很好。
但是,在Firefox ESR 10上,httpRequest.responseXML在处理程序过程中是 null (infoReceived)
请提示吗?
我查看了MDN文档,但没有关于ESR 10版本中不兼容性的说明。
答案 0 :(得分:2)
好的,我明白了。
之前(处理函数内部):
var response = httpRequest.responseXML;
之后(内部处理函数):
var parser = new DOMParser();
var response = parser.parseFromString(httpRequest.responseText, "text/html");
之前(主要功能):
httpRequest.responseType = "document";
之后(主要功能):
//httpRequest.responseType = "document";
我还在MDN doc内找到了正确的信息: