Interpretation of section 3 Ajax, Xin Xing jquery, 2014
* ************** Ajax *********************
1. ajax is short for Asynchronous Javascript And XML. It refers to Asynchronous Javascript And XML. In short, it means to interact with the server without refreshing the entire page, and can be displayed on the webpage.
2. jQuery's support for Ajax is still comprehensive. It allows us to read information from the server in GET or POST mode and display it.
3. jQuery supports Ajax using the following methods.
* ************* Load method *******************
1. The load method loads data from the server and puts the returned data into the selected element. Syntax format:
$ (Selector). load (URL, data, callback );
2. the URL here is the URL address to which we want to send data. The data parameter is optional. It specifies a set of query string key-value pairs sent together with the request, the optional callback parameter is the name of the function executed after the load method is complete.
3. For example, if the backend server uses php as an example, we first write an html file at the front end. The Code is as follows:
<Html> Then we need to create a new a. php file under the www directory or htdocs directory. Its content is as follows:
<? Phpecho "I am Xin Xing ";
Then we run the page. When we click the "query" button, we find that the above text has not changed, but the "click the button below to display information" is changed to "I am Xin Xing", this is a simple asynchronous transmission.
****************
1. Of course, load has other parameters. For details, refer to the manual.
2. Two other functions are also widely used, namely get and post. We will discuss them in the next section.