Ajax working principle graphics and text detailed

Source: Internet
Author: User

-ajax
A. Full name: Asynchronous JavaScript and XML (asynchronous JavaScript and XML)
B. Meaning: A Web development technology for creating interactive Web applications
C. function: To achieve local refresh, reduce server pressure
D. Principle of work:

Pictures: web. Jpg

Traditional Web applications allow users to fill out forms and send an HTTP request to the Web server when submitting a form. The server receives and processes the form that came in,
Then return a new page to the user's browser. As the illustration shows, the traditional Web application works. When using traditional Web applications, to change the page
A small amount of data that needs to reload the entire page, which is an unfriendly user experience. And because each application's interaction needs to be sent to the server
Requests, the response time of the application depends on the response time of the server, which can cause the user to spend longer wait times.
Photo: Ajax. Jpg

Unlike traditional Web applications, Ajax uses an asynchronous interaction process. Ajax can only send and retrieve the necessary data to the server, which uses SOAP
(Simple Object Access Protocol) or some other xml-based Web Service interface, and use JavaScript on the client to handle the response from the server.
The data that the user obtains on the page is provided through the Ajax engine, because the page does not need to interact directly with the server, so the client browser does not need to brush
The new page will be able to get information about the server and improve the friendliness of the page.

Main:

  code is as follows copy code
function          CallServer (value) {
   createxmlhttpobject ();     //Create a XMLHTTP object
   xmlhttp.open ("Get", "for.php?id=" +value,true); Create an HTTP request
   xmlhttp.onreadystatechange=updatepage;                    //defines the function of the response
   xmlhttp.send (null);   //Send request
}


Note:
1. Get the contents of a text box
           A.document.myform.user.value (JS file)
           B.this.value (in HTML file)
2. Note Character Set
           if you output the results including Chinese, Be aware of the problem with the character set. That is, the character set of the JS file and the character set of the PHP file should be convertible
           Example: I am using Easyeclipse, The new Ajax.js file's character set defaults to Iso-8859-1, so that the PHP file
should be UTF and not GBK, may be gkb and ISO can not convert the reason. and UTF more ' take all '. Of course, you can convert the
JS file to UTF8, which avoids a lot of problems.

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.