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).