From a4901402184f6d339d6fd068ea2698ebdb9bf5f8 Mon Sep 17 00:00:00 2001 From: Fabrixxm Date: Thu, 16 Oct 2014 10:51:36 +0200 Subject: [PATCH] add jsonp support to api --- include/api.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/include/api.php b/include/api.php index f6096f2907..db55c05fed 100644 --- a/include/api.php +++ b/include/api.php @@ -166,7 +166,10 @@ case "json": header ("Content-Type: application/json"); foreach($r as $rr) - return json_encode($rr); + $json = json_encode($rr); + if ($_GET['callback']) + $json = $_GET['callback']."(".$json.")"; + return $json; break; case "rss": header ("Content-Type: application/rss+xml");