Created
May 6, 2016 10:35
-
-
Save samcroft/aa9e302e4b5bb9ee4586994f799b10a6 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
header('Content-Type: application/json'); | |
$callback = isset($_GET['callback']) ? $_GET['callback'] : false; | |
$output = array( | |
'some' => 'data' | |
); | |
$output = json_encode($output); | |
if ($callback) { | |
echo sprintf('%s(%s)', $callback, $output); | |
} else { | |
echo $output; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment