Better XHR requests.

Refactored the asynchronous request caller into a module.