Differences between Get requests and Post requests in Ajax: ajaxgetpost requests

Source: Internet
Author: User
Tags html header

Differences between Get requests and Post requests in Ajax: ajaxgetpost requests

1. When a Get request is used, the parameter is displayed in the URL, but the Post method is not displayed, so the post method is safer (same as Article 4 ).

2. For the get method, the server uses Request. QueryString to obtain the value of the variable. For the post method, the server uses Request. Form to obtain the submitted data. You can use Request to obtain parameters in either of the two methods.

3. The data volume transmitted by get is small and cannot exceed 2 kb. The amount of data transmitted by post is large, which is generally not restricted by default. However, in theory, it varies with the server.

4. Low get security and high post security.


Note:
Get method: a URL contains all the information required to retrieve the request information. You can add the URL to the URL for future calls. The transmitted data is displayed in the address bar,

It is a batch stream transmission with limited data volume and Chinese garbled characters.


Post method: Package and send the data, encrypt the data, and ensure high security. There is no limit on the amount of data transmitted and cannot be added to bookmarks.


The difference between GET and POST in AJAX and GET and POST in HTTP

First, let's take a look at the difference between get and post.
1. get adds the parameter data queue to the URL referred to by the ACTION attribute of the submission form. The values correspond to each field in the form one by one and can be seen in the URL. Post uses the HTTP post mechanism to place fields in the form and their content in the html header and send them to the URL address referred to by the ACTION attribute. You cannot see this process.

2. For the get method, the server uses Request. QueryString to obtain the value of the variable. For the post method, the server uses Request. Form to obtain the submitted data. You can use Request to obtain parameters in either of the two methods.

3. The data volume transmitted by get is small and cannot exceed 2 kb. The amount of data transmitted by post is large, which is generally not restricted by default. However, in theory, it varies with the server.

4. Low get security and high post security.

5. <form method = "get" action = "a. asp? B = B "> with <form method =" get "action =". asp "> is the same. That is to say, the parameter list behind the action page is ignored, while <form method =" post "action =". asp? B = B "> unlike <form method =" post "action =" a. asp ">.

In addition
A Get request has the following features: it adds data to a URL and passes the data to the server in this way. Generally, a question mark is used? It indicates the end of the URL address and the beginning of the Data parameter. Each Data parameter in the following parameter appears in the form of "name = value". A connector & is used to distinguish between the parameter and the parameter.
Post requests have the following features: data is stored in the HTTP body. They are organized in different ways, including connection and delimiter, which can hide parameters and transmit a large amount of data, convenient.

All in all: when submitting a form, we usually use the post method. When we want to transmit a large data file, we need to use post. When the passed value only needs to be in the parameter mode (this value is not greater than 2 kb), use the get method.

Therefore, the use of ajax to submit both is naturally clear.

Different methods in AJAX and synchronous and asynchronous are divided into GET and POST:

Get has a length limit and the request information appears in the address bar.
There is no limit on the length of the post request and the information will not appear in the address bar.

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.