title: Send php response to ajax
body: <p>Okay I have a php script which ends as so :</p>
  
  <pre><code>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);
  </code></pre>
  
  <p>And some jquery that I was planning on having alert me when my script is working.</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>edited source</p>