CORS (Cross-origin resource sharing) happens when the JavaScript makes a cross-domain XHR (XMLHttpRequest) call. On Wikipedia stands this image that gives more information about the workflow of CORS.
More information about CORS can be found on the Mozilla Developer Network.