add jsonp support to api

This commit is contained in:
Fabrixxm 2014-10-16 10:51:36 +02:00
parent 295b4d7f61
commit a490140218
1 changed files with 4 additions and 1 deletions

View File

@ -166,7 +166,10 @@
case "json": case "json":
header ("Content-Type: application/json"); header ("Content-Type: application/json");
foreach($r as $rr) foreach($r as $rr)
return json_encode($rr); $json = json_encode($rr);
if ($_GET['callback'])
$json = $_GET['callback']."(".$json.")";
return $json;
break; break;
case "rss": case "rss":
header ("Content-Type: application/rss+xml"); header ("Content-Type: application/rss+xml");