Initial attempt at de-PHP-ifying the XHR tests (not yet well tested)