DokuWiki

It's better when it's simple

User Tools

Site Tools


devel:event:ajax_call_unknown

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

devel/event/ajax_call_unknown.txt · Last modified: 2018-12-08 14:57 by torpedo

Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Share Alike 4.0 International
CC Attribution-Share Alike 4.0 International Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki