Kneeling for Ajax problems
Chat window
Chat
with
The GetMessage () function above is to get Ajax to find out the data, getMessage () function inside the. onreadystatechange the specified callback function in Window.alert (MES); Print out always empty, But the GetMessage page of my AJAX request has returned Data Ah, here's the code for AJAX request GetMessage
Include "MessageServer.class.php";
@header ("Cache-control:no-cache");
$getter = $_post[' getter '];
$sender = $_post[' sender '];
Call messageserive For information
$messageServer = new Messageserver ();
$messList = $messageServer->getmessage ($getter, $sender);
Echo $messList;
?>
Echo $messLis T is a data output, the output is
------to solve the idea----------------------
Receive
var mes=myxmlhttprequest.responsexml;
if (mes.xml = = ") {
alert (Myxmlhttprequest.responsetext);
Return
}
Window.alert (MES); It's always null to print out here.
------to solve the idea----------------------
is the data stream, you do not define the input content format, which can be either JSON or data
------to solve the idea----------------------
if (myxmlhttprequest.status==200) {
if (myxmlhttprequest.recvtype== "XML")
Echo Myxmlhttprequest.responsexml;
}