From: Fabrixxm Date: Thu, 16 Oct 2014 08:51:36 +0000 (+0200) Subject: add jsonp support to api X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=a4901402184f6d339d6fd068ea2698ebdb9bf5f8;p=friendica.git add jsonp support to api --- 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");