GET vs POST in AJAX?

Viewed 22124

Why are there GET and POST requests in AJAX as it does not affect page URL anyway? What difference does it make by passing sensitive data over GET in AJAX as the data is not getting reflected to page URL?

9 Answers

Another difference between GET and POST is the way caching is handled in browsers. POST response is never cached. GET may or may not be cached based on the caching rules specified in your response headers.

Thanks.. I mainly use the GET method with Ajax and I haven't got any problems until now except the following:

Internet Explorer (unlike Firefox and Google Chrome) cache GET calling if using the same GET values.

So, using some interval with Ajax GET can show the same results unless you change URL with irrelevant random number usage for each Ajax GET.

When we use the GET method in Ajax, only the content of the value of the field is sent, not the format in which the content is. For example, content in the text area is just added in the URL in case of the GET method (without a new line character). That is not the case in the POST method.

Related