Table of Contents
AJAX_CALL_UNKNOWN
- Description:
- Handle AJAX calls
- DefaultAction:
- Sends an "AJAX call <call> unknown!" message.
- Preventable:
- yes
- Added:
- 2006-08-09
The event is signaled from lib/exe/ajax.php if the AJAX call is not recognized and allows you to add your own functionality to the AJAX backend.
Passed Data
The passed Doku_Event object has the field $data
.
$data
is a string containing the AJAX call name from $_POST['call'] (or otherwise $_GET['call']).
Add a BEFORE event handler to add your functionality. Check the $data
field for correct call name. Also use a unique AJAX call name to avoid collisions. For example plugin_<pluginname>
.
Remember to use preventDefault()
to prevent “call unknown” message. Use possibly stopPropagation()
when handling an unknown AJAX event, this keeps other handlers from corrupting your returned data.
The AFTER event handler is only executed if preventDefault()
is called by your or another executed BEFORE event handler. Otherwise it is never reached. This AFTER event handler is for normal use cases not useful.
See also
- Code related to this event used in any DokuWiki's files, plugins and templates
- Example: Handle JSON ajax request