ajax jquery returns error even though every function succeeds

ajax jquery returns error even though every function succeeds

Hello, I have an ajax jquery form, it does everything correct, inserts into database and sends email, but with the php mail function this jquery always returns error, not success, so i get an error message:

$("‪#‎ajaxform‬").submit(function(e)
{
var testval = $("#ajaxform");
if( $("#ajaxform").valid())
{
e.preventDefault();
$("‪#‎simple‬-msg").html("<img src='img/loading.gif'/>");
var postData = $(this).serializeArray();
var formURL = $(this).attr("action");
$.ajax(
{
url : formURL,
type: "POST",
data : postData,












success:function(data, textStatus, jqXHR)
{
$("#simple-msg").html(''+data+'');
document.getElementById('captcha').src='captcha.php?'+Math.random();
},
error: function(jqXHR, textStatus, errorThrown)
{
$("#simple-msg").html('<pre><code class="prettyprint">AJAX Request Failed<br/> textStatus='+textStatus+', errorThrown='+errorThrown+jqXHR+'</code></pre>');
document.getElementById('captcha').src='captcha.php?'+Math.random();
}
});
e.preventDefault(); //STOP default action
e.unbind();
}
//$("#ajaxform").submit();
//setTimeout($("#ajaxform").submit(), 1000);
});
in my class when I uncom,ment this line, I get an error, even though the email is sent:
$mail1 = @mail("$email", "$subject", "$mailcontent1", "$headersghh");
I get a response:
textStatus=error, errorThrown=Service Unavailable



















AJAX Request Failed

even with this everythign works correct, the email is sent, and the data inserted into mysql database

My Jquery:
<script src="js/jquery-1.9.1.js" type="text/javascript"></script>
<script src="js/jquery-ui.js" type="text/javascript"></script>
<script src="js/jquery.validate.js"></script>


Many Thanks