how to return successfull json response in php api code example Example: php json response to ajax <?php echo json_encode($data); ?>