Cross domain access to data on the server PHP

If you are doing a ajax call to retrieve data from your own server on a platform which is set to prevent these ajax calls . To bypass “Access-Control-Allow-Origin” you need to allow cross domain access by including this in your server php code.

 header('Access-Control-Allow-Origin: *'); 

OR – for only one domain

 header('Access-Control-Allow-Origin: http//your-domain.com'); 

I hope this will help you gain access to you cross-domain data.

Leave a Reply

Your email address will not be published. Required fields are marked *