Less invasive code injection on AJAX requests

Fixes the bungling introduced in
efa8de4470ab0859e901fa336f7aa21c1fcf8d06, but may not offer salvation
for people suffering from the original output buffering error.