This shows you the differences between two versions of the page.
Both sides previous revision Previous revision | |||
plugin_tutorial_javascript [2017/11/01 15:22] 127.0.0.1 external edit |
plugin_tutorial_javascript [2018/10/16 11:03] Christoph M. Becker Fix Ajax code snippet |
||
---|---|---|---|
Line 80: | Line 80: | ||
<code=php>if (isset($_GET['myplugin_xhr'])) { // handle XHR of myplugin | <code=php>if (isset($_GET['myplugin_xhr'])) { // handle XHR of myplugin | ||
+ | while (ob_get_level()) { // purge existing output buffers | ||
+ | ob_end_clean(); | ||
+ | } | ||
header('Content-Type: text/plain'); // set the appropriate Content-Type header | header('Content-Type: text/plain'); // set the appropriate Content-Type header | ||
echo $plugin_tx['myplugin']['response']; // sent the response | echo $plugin_tx['myplugin']['response']; // sent the response |