Categories
AJAX Tips and Tricks HTTP Tips & Tutorials JavaScript Tips & Tutorials

Which is better for AJAX requests, GET or POST?

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.

By Yang Yang

Hello, I'm Yang. I build online businesses that please people. Want to join in and post some useful articles on Kavoir.com? Shoot me a message.