Okay I have a php script which ends as so :
if ($success)
{
$result = array('success' => true);
}
else
{
$result = array('success' => false, 'message' => 'Something happened');
header($_SERVER['SERVER_PROTOCOL'] . ' 500 Internal Server Error', true, 500);
}
echo json_encode($result);
And some jquery that I was planning on having alert me when my script is working.
jQuery(document).ready(function() {
$.ajax({
url: './contactengine.php',
type: 'GET',
dataType: 'JSON',
success: function(response) {
alert("GOOD");
},
error: function() {
alert("BAD");
}
});
});
edited source