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

php中运用ajax时ResponseText返回undefined

WBOY
Release: 2016-06-13 10:47:52
Original
1365 people have browsed it

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,十分崩溃!!!
Copy after login


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


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

我不知道 FF 下的 XMLHttpRequest 是否也支持同步传输,所以才有这一说
Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template