summaryrefslogtreecommitdiffstats
path: root/examples/ajax-broker/api.php
diff options
context:
space:
mode:
Diffstat (limited to 'examples/ajax-broker/api.php')
-rw-r--r--examples/ajax-broker/api.php6
1 files changed, 3 insertions, 3 deletions
diff --git a/examples/ajax-broker/api.php b/examples/ajax-broker/api.php
index 996b813..304febd 100644
--- a/examples/ajax-broker/api.php
+++ b/examples/ajax-broker/api.php
@@ -8,8 +8,8 @@ if (empty($_REQUEST['command']) || !method_exists($broker, $_REQUEST['command'])
header("Content-Type: application/json");
header("HTTP/1.1 400 Bad Request");
echo json_encode(['error' => 'Command not specified']);
- exit();
-}
+ return;
+}
try {
$result = $broker->{$_REQUEST['command']}();
@@ -22,7 +22,7 @@ try {
if (!empty($_GET['callback'])) {
if (!isset($result)) $result = null;
if (!isset($status)) $status = isset($result) ? 200 : 204;
-
+
header('Content-Type: application/javascript');
echo $_GET['callback'] . '(' . json_encode($result) . ', ' . $status . ')';
return;