Pass is_ajax through from the ajax handler

Fixes #5910