When the code send the request, you shall have a “200 OK” response code in your browser console, which means that the resource is accessed, but it does not grant the right to share that resource. It does this by not allowing “Access-Control-Allow-Origin”.
To change that, you have to write this in the .htaccess of the requested domain file (notyourdomain.com):
Add following code to your .HTACCESS file
Header set Access-Control-Allow-Origin “*”