Ok, I have a php script that ends like this:
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 planned to warn when my script is running.
jQuery(document).ready(function() { $.ajax({ url: './contactengine.php', type: 'GET', dataType: 'JSON', success: function(response) { alert("GOOD"); }, error: function() { alert("BAD"); } }); });
edited source
source share