--- json_server.module Thu Apr 03 07:15:30 2008 +++ json_server.module Thu Apr 03 07:14:54 2008 @@ -11,12 +11,27 @@ function json_server_server_error($message) { return array("status" => FALSE, "message" => $message); } function json_server_server() { - if (!isset($_POST)) { - return "JSON server accepts POST requests only."; + if(empty($_POST)){ + $service_method = $_GET['method']; + $callback = $_GET['callback']; + $methods = services_get_all(); + $args = array(); + foreach ($methods as $method) { + foreach($method['#args'] as $arg) { + if(isset($_GET[$arg['#name']])) { + $args[] = $_GET[$arg['#name']]; + } + } + } + + $result = services_method_call($service_method, $args); + $json = $callback.'('.drupal_to_js(array('status' => "1", 'data' => $result)).')'; + return $json; + exit; } $request = $_POST['method']; $methods = services_get_all(); $args = array();