1

Possible Duplicate:
When do you use POST and when do you use GET?

If I use jQuery ajax call to communicate with server, in general, when should I use type get to call and when should I use post to call ?

Community
  • 1
  • 1
Leem.fin
  • 40,781
  • 83
  • 202
  • 354

3 Answers3

1

POSSIBLE DUPLICATE: When do you use POST and when do you use GET?

GET:

  • GET is cacheable
  • GET can remain in browser history, and be bookmarked
  • If you want to be able to visit the content based on a URL (good for sharing links).
  • If the parameters return view-oriented content.
  • Some people say GET can be less safe than POST -- but to the seasoned user, this doesn't make any significant difference because they can intercept and modify headers of the request.
  • GET can be quicker compared to POST, as it is a one step request (POST sends headers first, then the body of the request).

POST:

  • Sending login data.
  • Sending non-ascii data.
  • If the data makes the URL for GET too long (over the maximum limit of characters).
  • If you want to make some data hidden to the typical user.

Ref:
http://www.cs.tut.fi/~jkorpela/forms/methods.html
http://thinkvitamin.com/code/the-definitive-guide-to-get-vs-post/

Community
  • 1
  • 1
invalidsyntax
  • 640
  • 1
  • 5
  • 14
0

You need to know their differences, to know which to use. When the GET request is used, the sent data is shown in the address bar, with the url. The POST request is used to send data to the server without showing it anyway. And also POST is used to send files or other large data.

So if you're sending confident info like password, you use POST. When you're passing a data to be used in the page like "page=about" or "article_id=2", use GET.

ArVan
  • 4,225
  • 8
  • 36
  • 58
0

instead of using get i usually just use $.load and fetch code chunks and insert them into the dom. i use post for pretty much everything else, or getJSON.

Chris Brickhouse
  • 650
  • 5
  • 15