jquery contact form php issue
<p>So I have a contact field which sends an email when submitted, I want to have the javascript alert when complete but am returning issues.</p>

<p>The javascript:</p>

<pre><code>jQuery(document).ready(function() {

    $.ajax({
        url: './contactengine.php',
        type: 'GET',
        dataType: 'JSON',
        success: function(response) {
                        alert("GOOD");
                },
        error: function() {
                        alert("BAD");
                }
    });

});
</code></pre>

<p>The php:</p>

<pre><code>&lt;?php

$EmailFrom = "emailname@gmail.com";
$EmailTo = "emailto@gmail.com";
$Subject = "new contact from website";
$Name = Trim(stripslashes($_POST['Name'])); 
$company = Trim(stripslashes($_POST['company'])); 
$Email = Trim(stripslashes($_POST['Email'])); 
$Message = Trim(stripslashes($_POST['Message'])); 

// validation
$validationOK=true;
if (!$validationOK) {
  print "&lt;meta http-equiv=\"refresh\" content=\"0;URL=error.htm\"&gt;";
  exit;
}

// prepare email body text
$Body = "";
$Body .= "Name: ";
$Body .= $Name;
$Body .= "\n";
$Body .= "company: ";
$Body .= $company;
$Body .= "\n";
$Body .= "Email: ";
$Body .= $Email;
$Body .= "\n";
$Body .= "Message: ";
$Body .= $Message;
$Body .= "\n";

// send email 
$success = mail($EmailTo, $Subject, $Body, "From: &lt;$EmailFrom&gt;");

// redirect to success page 
if ($success)
{
    $result = array('success' =&gt; true);
}
else
{
    $result = array('success' =&gt; false, 'message' =&gt; 'Something happened');
    header($_SERVER['SERVER_PROTOCOL'] . ' 500 Internal Server Error', true, 500);
}
  echo json_encode($result);
?&gt;
</code></pre>

<p>When I submit the form I get redirected to a page which says the following:</p>

<pre><code>{"success":true}
</code></pre>

<p>When I should be staying on the same page and just alerting good.</p>
