Add support for CORS / XHR

Not ready for merging yet as there are no tests, but all is working and more importantly the existing tests are passing.
here's how jQuery decides a successful result based on status code https://github.com/jquery/jquery/blob/master/src/ajax.js#L684