Example Tool'; UI::inlineJS(__FILE__ . '.example.js', [ 'URL_TEST_AJAX_ACTION' => $this->getLink('testAjax'), ]); UI::dol(); } public function testAjaxAction() { Response::sendTryCatchJson(array($this, 'testAjax'), $_REQUEST); // args from request // Response::sendTryCatchJson(array($this, 'testAjax'), $args = 'JSON_FROM_REQUEST_BODY'); // args from json request } public function testAjax($args) { // args given by sendTryCatchJson $items = [ [ 'ID' => 1, 'name' => 'x', 'desc' => 'a' ], [ 'ID' => 2, 'name' => 'y', 'desc' => 'b' ], [ 'ID' => 3, 'name' => 'z', 'desc' => 'c' ], ]; return [ 'type' => 'success', 'msg' => 'OK', 'body' => [ 'items' => $items, ] ]; } }