Permalink
Browse files

[ADDED] JSONP support for MPOS API

Fixes #1700 once merged.

Thanks @spliznork for the feature request and solution.
  • Loading branch information...
Sebastian Grewe
Sebastian Grewe committed Feb 7, 2014
1 parent 93470fd commit a03b9d4acec9597a0f3db5c2d00c97018c0d6c7c
Showing with 5 additions and 1 deletion.
  1. +5 −1 public/include/classes/api.class.php
@@ -28,13 +28,17 @@ function isActive($error=true) {
* @return string JSON object
**/
function get_json($data, $force=false) {
return json_encode(
$json = json_encode(
array( $_REQUEST['action'] => array(
'version' => $this->api_version,
'runtime' => (microtime(true) - $this->dStartTime) * 1000,
'data' => $data
)), $force ? JSON_FORCE_OBJECT : 0
);
// JSONP support issue #1700
if (isset($_REQUEST['callback']))
return $_REQUEST['callback'] . '(' . $json . ');';
return $json;
}
/**

0 comments on commit a03b9d4

Please sign in to comment.