Which is better for AJAX requests, GET or POST?

by Yang Yang on January 9, 2009

As per HTTP protocol specifications, client browsers send http post requests in two-step processes: 1) send the headers, 2) send the data.

Therefore, for websites with high volume traffic, it’s definitely preferable to choose GET method for AJAX requests over HTTP, because all it takes for GET to get out is a URL request, which is basically a TCP packet if you don’t have a lot of cookies.

However, as there is a limit on the length of the URL in Internet Explorer which is approximately 2k, so technically you can’t send a GET request with data more than that.

Another approach is to determine whether to use GET or POST is that, according to HTTP specification, GET is for fetching data while POST is for supplying. In this sense, use GET for data retrieval tasks and POST for data input tasks.

Comments on this entry are closed.

Previous post:

Next post: