Kneeling for AJAX-related issues

Source: Internet
Author: User
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;
}
  • Related Article

    Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.