Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Difference between jquery.post and jquery.get?

Tags:

jquery

What is the difference between those two AJAX calls and why would I choose to use either when using the asp.net mvc framework?

like image 726
Shawn Mclean Avatar asked Mar 03 '10 21:03

Shawn Mclean


1 Answers

One uses POST and one uses GET.

As far as what they're meant for - the only real technical difference (please correct this post if I'm wrong) is that GET has a much shorter limit to the query string. In practice, GET is meant for when fetching something from the server. A GET call should not cause side effects on the server. POST is when you intend to send something on the server and have it do something with it.

edit: the word I was looking for, to describe GET, is idempotent. You should be able to make the exact same GET call an unlimited number of times, and get the same result every time, with no consequence to the server (provided of course that no one else has changed the server's state.) But remember that there are no technical barriers preventing you from misusing either GET or POST.

like image 115
Tesserex Avatar answered Sep 19 '22 09:09

Tesserex