Jquery&ajax applications

Source: Internet
Author: User

jquery encapsulates Ajax operations in jquery, where the $.ajax () method belongs to the lowest-level method, the second layer is the load (), the $.get (), and the $.post () method, the third layer is the $.getscript (), the $.getjson () method, The second-tier approach is highlighted because of its high utilization rate.

1. Load () method
Function: Loads the remote HTML code and inserts it into the DOM, with the following structure:
Load (URL [. data] [. callback]);
The load () method is passed according to the parameter data from the specified, if there is no parameter passed, the use of a Get method, or vice versa, will be automatically converted to post mode.

2, $.get () method and $.post () method

The difference is as follows:
1) The GET request passes the parameter after the URL, while the POST request is sent to the Web server as the entity content of the HTTP message, but in Ajax, the difference is not visible to the user;
2) The Get mode has a size limit on the transmitted data (usually not >2kb), and the amount of data passed by post is much larger than get (theoretically unrestricted);
3) The data requested by the Get method is cached by the browser, so that other people can read the data from the browser's history, such as account number and password. In some cases, the Get method can lead to serious security problems, and post is a relatively safe way to avoid these problems.
4) Get mode and post method of the data passed on the server is not the same, in PHP, get data can be obtained with $_get[], and post data can be obtained by $_post[], both ways can be obtained by $_request[].

Jquery&ajax applications

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.