jQuery to perform ajax request from form upon submission?

What jQuery would I use to (check and then) send the contents of a simple form to a PHP form using AJAX?

The form collects an address and the server will send an email and then confirm the success of the operation.


Depending on your needs, the $.ajax() method is a litte more versatile than the $.post()..

You can dynamically define whether or not you want to use the get or post method...

An example from the website below:

   type: "POST",
   url: "some.php",
   data: "name=John&location=Boston",
   success: function(msg){
     alert( "Data Saved: " + msg );

where data can be info from your form and msg is the response data from the request :)

To attach to the submit button click event, put the above code within this function:

$('#submitButton').click(function () {

read more here: http://api.jquery.com/jQuery.ajax/

hope that helps :)

Need Your Help

Access global variables through Helper

javascript localization handlebars.js

How can I access a global variable through a helper function in Handlebars.js for the purpose of localization? Here's what I've got so far. The problem I'm seeing is that the parameter 'string' is

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.