Skip to content

Commit 6b8a13e

Browse files
committed
jsonp support for status
1 parent 822901d commit 6b8a13e

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

www/status.php

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,20 @@
2424
$retVal["sys_getloadavg()"] = sys_getloadavg();
2525
$retVal["sys_get_temp_dir()"] = sys_get_temp_dir();
2626

27-
header('Content-type: text/plain');
28-
echo json_encode($retVal);
27+
if (isset($_REQUEST['callback']))
28+
{
29+
header('content-type: application/javascript; charset=utf-8');
30+
echo $_REQUEST['callback'];
31+
echo "(";
32+
echo json_encode($retVal);
33+
echo ")";
34+
}
35+
else
36+
{
37+
header('content-type: application/json; charset=utf-8');
38+
header("Access-Control-Allow-Origin: *");
39+
header('Access-Control-Allow-Methods: POST, GET');
40+
header('Access-Control-Max-Age: 604800');
41+
echo json_encode($retVal);
42+
}
2943
?>

0 commit comments

Comments
 (0)