I’m getting this error when I call an Ajax function to a PHP to insert records or retrieve data, though occasionally sometimes the data will get through:
has been blocked by CORS policy: No ‘Access-Control-Allow-Origin’ header is present on the requested resource.
I’ve read up a bit about it, and it was working fine more or less on a free server which was automatically protected under SSL. I’ve since purchased a dedicated domain without SSL and now I’m hitting this error again. Would adding SSL fix this? or is this something the hosting company can only answer?
I do actually have a SSL directory in my root folder of my website - I’m not really up too much with this, should the PHP scripts be accessed from there maybe?
I originally got around the problem on the free site by adding the following header to my PHP files, but that’s not working in this instance:
header('Access-Control-Allow-Origin: *');
One final note, it was working without problems on an actual Android device - just not in Chrome - is CORS only relevant to browsers, or am I likely to hit problems once I try to roll the app out to iOS and phones with newer versions of Android?