Questions about PHP and Ajax

Source: Internet
Author: User
Questions about PHP and Ajax QT. php & lt; script & nbsp; src = "& nbsp; http://ajax.googleapis.com/ajax/libs/jquery/1.4.0/jquery.min.js" & gt; & lt;/script & gt; & lt; script about PHP and Ajax
QT. php

Script
Script
Var sendData = {
'Name': 'A ',
'Psw': 'B'
}; // Construct post data
$. Post ('ht. php', sendData, function (data) {// implement ajax
If (data. indexOf ('error ')! =-1) // data is your echo information on the php side
{
Alert ('error occurred ');
Return false;
} Else {
Alert (data );
}
});
Script


HT. php

$ Name = $ _ REQUEST ['name'];
Echo $ name;
?>

The preceding two files are available:
A qt. php
One HT. php
During my local computer lab
You can omit $ name = $ _ REQUEST ['name '];
However, this sentence must be added after the file is uploaded to the server.
Why? Php ajax:
------ Solution --------------------
You can omit $ name = $ _ REQUEST ['name '];
It indicates that your php version is very low and php runs in an extremely insecure environment.

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.