Ok, to make long story short:
JavaScript:
jQuery(\"submit\").click(function() {
var address = jQuery(\"#mail\").val();
var title = jQuery(\
You should use Ajax. Its a lot easier. Here is a simple tutorial here on sending mail using PHP, Ajax, & jQuery:
Send mail using PHP, Ajax and jQuery
it would look something similar to this:
var data = "address=" + address + "&title=" + title + "&name=" + name + "&mail=" + mail + "&message=" + message;
//or however u want to format your data
$.ajax({
type: "POST",
url: "sendmail.php",
data: data,
success: function(phpReturnResult){
alert('Success: ' + phpReturnResult);
jQuery(".email-us").html("<div id='email-sent'><p>Thank you for the message.</p><p>We will reply as soon as possible. PHP Script's return result: " + phpReturnResult + "</p></div>");
},
error: function(errormessage) {
//you would not show the real error to the user - this is just to see if everything is working
alert('Sendmail failed possibly php script: ' + errormessage);
}
});
Also in your PHP file, you seem to used the mail function twice.