How to make a cross domain request in JavaScript using CORS
Cross-origin resource sharing (or CORS) can be used to make AJAX requests to another domain. We’ll look at how to set up CORS on the server in PHP, how to make the request in JavaScript and some considerations.