display error from jquery post
<p>i am posting to a mailer.php file.<br>
mailer.php</p>

<pre><code>&lt;?php
if(isset($_POST['submit'])) {

$to = "testabc@gmail.com";
$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!";

}
?&gt;
</code></pre>

<p>here is my js code</p>

<pre><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></pre>

<p>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?</p>
