header('Cache-Control: no-cache, must-revalidate');
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
header('Content-type: application/json');
The first two headers prevent the browser from caching the response and the third sets the correct MIME type for JSON.
Than just output your JSON data
$data = array( "fire" => 1, "water" => 0, "earth" => 1, "air" => 1, ); echo json_encode($data); exit;
