Home  >  Article  >  Backend Development  >  php中运用ajax时ResponseText返回undefined

php中运用ajax时ResponseText返回undefined

WBOY
WBOYOriginal
2016-06-13 10:47:521306browse

php中使用ajax时ResponseText返回undefined

JScript code
<!--Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/-->var URL, ReturnHtml;var objXMLHTTP = new GetXmlHTTP();alert(objXMLHTTP); //FF下创建对象XMLHttpRequest成功URL = "getdata.php?username="+ document.getElementById("username").value;objXMLHTTP.open("GET", URL, false);objXMLHTTP.send(null);ReturnHtml = objXMLHTTP.ResponseText;alert(ReturnHtml); //FF下总是返回undefined,十分崩溃!!!


在IE下使用正常, FF下创建对象(XMLHttpRequest)成功,但到获取objXMLHTTP.ResponseText时总是返回undefined~


------解决方案--------------------
你的 objXMLHTTP.open("GET", URL, false);
是同步传输

我不知道 FF 下的 XMLHttpRequest 是否也支持同步传输,所以才有这一说
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn