use dokuwiki\Extension\ActionPlugin; use dokuwiki\Extension\EventHandler; use dokuwiki\Extension\Event; class action_plugin_example extends ActionPlugin { /** * plugin should use this method to register its handlers * with the dokuwiki's event controller */ public function register(EventHandler $controller) { $controller->register_hook('AJAX_CALL_UNKNOWN', 'BEFORE', $this, 'ajaxCall'); } /** * handle ajax requests */ public function ajaxCall(Event $event) { if ($event->data !== 'plugin_example') { return; } //no other ajax call handlers needed $event->stopPropagation(); $event->preventDefault(); //e.g. access additional request variables global $INPUT; $name = $INPUT->str('name'); //data $data = []; //set content type header('Content-Type: application/json'); echo json_encode($data); } }