aboutsummaryrefslogtreecommitdiff
path: root/index.php
diff options
context:
space:
mode:
Diffstat (limited to 'index.php')
-rw-r--r--index.php10
1 files changed, 9 insertions, 1 deletions
diff --git a/index.php b/index.php
index b2ac826..be15116 100644
--- a/index.php
+++ b/index.php
@@ -1102,7 +1102,15 @@ function json_api_encode($data, $app, $flags=array()) {
//enable in production
$app->response->setContentType($header['japi'])->sendHeaders();
$data = get_meta_end($data, $app);
- echo json_encode($data);
+
+ //JSONP
+ if(isset($_GET['aportsjsonp']) || isset($_GET['callback'])) {
+ $callback = $_GET['aportsjsonp'] ? 'aportsjsonp' : $_GET['callback'];
+ echo $callback.'(' . json_encode($data) . ')';
+ } else {
+ echo json_encode($data);
+ }
+
}
// --------------------------