This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
plugin_tutorial_javascript [2014/05/21 20:14] Christoph M. Becker [Embedding in the Document] added footnote |
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 |