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....

5 Years
Discussion Span
Last Post by t_thakar

$.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
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.