$(document).ready(function(){
 $("#form").submit(function(){ //When the form is submitted by the user do the following...
  var dataString = $(this).serialize(); //Grab all the data input
  $.ajax({ //Start an AJAX request
   url: "mail.php", //We're using mail.php as a PHP script to send the email
   data: dataString, //This is the data we grabbed above
   type: "POST", //Well, we need to post the data to the mail.php file
   dataType: "html", //We will be receiving an HTML error/success message from mail.php
   success: function(data) //Once the AJAX request has been completed, do the following...
   {
     $('#message').html(data); //Display the message returned by the PHP script
   }
  });
  return false; //Stops the page refreshing/loading mail.php
 });
});
