Add support for CORS / XHR

This is ready to be looked over now.
No longer calls options.error if json parse fails or data is null.