VijayKR
VijayKR

Reputation: 33

Clearing some things out about JQuery Ajax

In jQuery

  1. What is the different between $.get method and $.post method?
  2. When is which one is better?
  3. $.Ajax is better than above things y we are using .get and .post method?

Upvotes: -2

Views: 56

Answers (1)

djlumley
djlumley

Reputation: 2967

$.get and $.post are subsets of the $.ajax method.

They're already set up for GET and POST requests and make it easier and quicker to code, in addition to making your code more readable.

$.ajax offers more control, but at the expense of readability, and speed (in terms of coding). It's more extensible, so is suited for functions where your standard $.get or $.post may not be sufficient.

Use whichever works for you. If all you're doing is trying to POST data, then $.post let's you do this simply. If you want more control, use $.ajax.

Upvotes: 1

Related Questions