1.11M Members

JQuery: difference between $.ajax and $.post


Hi Im new to JQuery and sorry if this question sounds silly.
my question is what is the difference between $.ajax and $.post and which is best if I am posting some form to a php and retriving some values on the same page as the form

e.g. contact us page will post form and the php backend sends email and confirms everything ok back to the contact us page with some confirmation text specific to the type of email.

i think $.post can post the form to a php script and use the returned values to display in the page. but i dont know if $.ajax does the same and if it does why two different thing that does the same thing?

what is the difference ...

thanks everyone....


$.post is a subset of $.ajax. As you can read on the manual page: This is a shorthand Ajax function, which is equivalent to:

  type: "POST",
  url: url,
  data: data,
  success: success,
  dataType: dataType
Question Answered as of 1 Year Ago by pritaeas

oh kool :) thanks for the fast reply

This question has already been solved: Start a new discussion instead
Start New Discussion
View similar articles that have also been tagged: