Home  >  Article  >  Web Front-end  >  What is the difference between post and get in ajax

What is the difference between post and get in ajax

青灯夜游
青灯夜游Original
2021-12-09 16:38:397923browse

Difference: 1. Get is to obtain data from the server, and post is to transmit data to the server; 2. The get method uses "Request.QueryString" to obtain data, and the post method uses "Request.Form" to obtain data; 3. , get security is very low, post security is high.

What is the difference between post and get in ajax

The operating environment of this tutorial: windows7 system, jquery1.10.2 version, Dell G3 computer.

The difference between post request and get request in Ajax

1. Different functions

1 , get is to obtain data from the server.

2. Post is to transmit data to the server.

2. The process is different

1. Get adds the parameter data queue to the URL pointed to by the ACTION attribute of the submitted form. The value Corresponds to each field in the form and can be seen in the URL.

2. Post uses the HTTP post mechanism to place each field in the form and its content in the HTML HEADER and transmit it to the URL address pointed to by the ACTION attribute. Users cannot see this process.

What is the difference between post and get in ajax

3. Obtaining different values ​​

1. For the get method, use Request.QueryString on the server side Get the value of a variable.

2. For the post method, the server uses Request.Form to obtain the submitted data.

4. The amount of data transmitted is different

1. The amount of data transmitted by get is small and cannot be greater than 2KB.

2. The amount of data transmitted by post is relatively large and is generally unrestricted by default. But in theory, the maximum amount is 80KB in IIS4 and 100KB in IIS5.

5. Different security

1. Get security is very low.

2. Post security is high.

If there is no encryption, their security level is the same, and any listener can listen to all the data.

get and post in ajax are two common methods for request-response on the client and server side. So, what is the difference between get and post requests? This article will introduce to you the difference between post request and get request in ajax. If you need it, please follow the blogger and save the article for easy reference next time.

#Finally, let’s take a look at the circumstances under which post requests and get requests are used.

When any of the following conditions are met, use the post method:

1. The result of the request has persistent side effects, for example, the database Add new data rows within.

2. If you use the GET method, the data collected on the form may make the URL too long.

3. The data to be transmitted does not use 7-bit ASCII encoding.

When any of the following conditions are met, use the get method:

1. The request is to find resources, and the HTML form data is only used to help search.

2. The request result has no persistent side effects.

3. The total length of the collected data and input field names in the HTML form shall not exceed 1024 characters.

[Related tutorial recommendations: AJAX video tutorial]

The above is the detailed content of What is the difference between post and get in ajax. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn