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:

$.ajax({
  type: "POST",
  url: url,
  data: data,
  success: success,
  dataType: dataType
});

oh kool :) thanks for the fast reply

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.