Hi everybody,
I'd like to use the bureacucracy script mode to make an ajax post request (fields json formatted) to a server. The return code/message of the server should be part of the Thanks Message. Is there any example? I'm a PHP-newbie ...
<form>
action script example.php
Thanks "Thanks for submitting your valuable data."
Labels labelsde
textbox "name"
email "email"
submit "submit"
</form>
Script in /config/plugin/bureacracy/example.php:
<?php
use dokuwiki\plugin\bureaucracy\interfaces\bureaucracy_handler_interface;
class bureaucracy_handler_example implements bureaucracy_handler_interface {
/**
* Log the form fields to DokuWiki's debug log
*/
public function handleData($fields, $thanks)
{
dbglog($fields, __FILE__ . ': ' . __LINE__);
dbglog($thanks, __FILE__ . ': ' . __LINE__);
/* need something like:
*
* Ajax.post(
* url = "
https://example.org/doBureaucracy",
* data = Json($fields)
* ).map($thanks)
*
*/
return $thanks;
}
}
Thanks
Robert