jQuery Introduction | Using Ajax | Ajax: HTTP Request Methods

HTTP Request Methods

When a client browser sends an HTTP request to a server, it uses one of the following methods.

  1. GET method
  2. POST method
  3. PUT method
  4. DELETE method

Other methods include HEAD, OPTIONS, TRACE, and CONNECT, but the four above are mainly used. In particular, GET and POST are used most often.

GET Method

The GET method sends data by adding it to the address.

HTTP requests made with the GET method are cached and stored by the browser. Also, because GET requests are usually sent as part of a query string, there is a length limit. Therefore, because security vulnerabilities exist, it is better to use the POST method when requesting important data.

POST Method

The POST method sends data by attaching it separately.

HTTP requests made with the POST method are not cached by the browser, so they do not remain in the browser history. Also, data from POST HTTP requests is sent separately from the query string. Therefore, there is no limit on the data length, and it is more secure than the GET method.

Comparison of GET and POST Methods

Feature GET method POST method
Cached Can be cached. Not cached.
Browser history The query string is recorded in the history. Not recorded in the history.
Data length The data length is limited to the length of the URL address. In Internet Explorer, the maximum URL address length is 2,083 characters, and only up to 2,048 characters are allowed for the pure path length. No limit.
Data type Only ASCII character data can be sent. No limit.
Security Because data is included in the URL address and sent, anyone can see it, making it very weak in terms of security. Because it is not recorded in browser history and data is sent separately, it is more secure than GET.

In major web browsers today, there is no fixed maximum URL address length except in Internet Explorer.