display error from jquery post

i am posting to a mailer.php file.
mailer.php\[code\]<?phpif(isset($_POST['submit'])) {$to = "[email protected]";$subject = "Contact via website";$name_field = $_POST['name'];$email_field = $_POST['email'];$message = $_POST['message'];$body = "From: $name_field\n E-Mail: $email_field\n Message:\n $message";echo "Data has been submitted to $to!";mail($to, $subject, $body);} else {echo "blarg!";}?>\[/code\]here is my js code\[code\]$('.submit').click(function(){ $('span.msg').css({'visibility': 'visible'}).text('Sending...'); $.post("mailer.php", $(".contactPage").serialize(), function(data){ $('span.msg').text('Your Message has been received. Thank you').show(); }); return false; });\[/code\]I am getting message of success but email is not received. What i am doing wrong? How to get error detail from mailer.php file and showing in span.msg?
 
Back
Top