Update ajax.js

* Treat 400 range HTTP Status Codes as errors
* Add X-Requested-With header