PHP Ajax Primer HelloWorld

Source: Internet
Author: User

Talking about Ajax

Ajax is the abbreviation for asynchronous JavaScript and XML (and DHTML, etc.).

It is made up of html+js+dom, and this tutorial does not involve DOM for the time being.

Concept of synchronization: Page submit post form, is the entire page waiting for the server to return (in a blank state), and then refresh? Yes, that's sync.

The concept of asynchrony: After a form is submitted, the rest of the page is used as usual.

Ajax is the page and server between the little one, as a section of JS code, it will be the page of the submission of information interception, and then processed to the server, and then listen to the server return information, and then feedback to the page.

To use it requires a handle: XmlHttp = new XMLHttpRequest ();

It is on this object that we play the role of the SAN.

The AJAX process can be understood by referencing the following comments:

1. Generate XMLHttpRequest Objects

2. Create the URL to jump

3. Open Server Conn

4. Set the function to execute after the server completes the operation

5.send Ajax

6. After the completion of the function to be followed by continuous monitoring (mechanism does not need us to implement)

Hey, from the St. Ma Jia Gou Men's vocational and technical college out of me, no culture, the above is their own superficial understanding.

To see the tall: Mastering Ajax, Part 1th: Introduction to Ajax

Actual operation

Create a new Testajax folder in wamp/www/with two files: index.html and getzipcode.php

Index.html

?

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 The

getzipcode.php

?

1 2 3 4 5 6 7 8 9 10 11-12 <!--? php if (!isset ($_get["City")) {echo ' url:city parameter is set?</br--> ';         }else{$city = $_get["City"]; if ($city!= null && $city!= "") {echo $city. "         _010 ";         }else{echo "is null?"; }}?>

Actual results:

No matter what my city input, the following ZIP code, will add a "_010", real-time.

Spit slot: ZipCode is the meaning of the ZIP code (English is taught by the PE teacher).

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.