I have a test.php file as:
<?php
header('Content-type: application/json');
$json_array = array();
$json_array['success']='1';
echo json_encode($json_array);
?>
On an input button click response needed in an alert.
<input type="button" id="btnSubmit" value="AJAX Request" />