Okej. I managed to solve the "success message" thing a day ago with the code below. Now how do I do the validation & php part. The user can disable javascript in there browser so I want things to be server sided to prevent spam.
<script>
$(function() {
$('#contactus').submit(function (event) {
event.preventDefault();
event.returnValue = false;
$.ajax({
type: 'POST',
url: 'php/mail.php',
data: $('#contactus').serialize(),
success: function(res) {
if (res == 'successful') {
$('#status').html('Det uppstod ett fel!').slideDown();
}
else {
$('#status').html('Tack! Ditt meddelande har skickat.').slideDown();
document.getElementById("contactus").reset();
}
},
error: function(XMLHttpRequest, textStatus, errorThrown) {
$('#status').html('Det uppstod ett fel!').slideDown();
}
});
});
});
</script>