As I am trying to make an Ajax cross domain request, I have come across a strange issue. In the console of Chrome dev tools, I see the following error:
"No 'Access-Control-Allow-Origin' header is present on the requested resource"
Despite this error message, when I check the network requests, everything seems to be working fine. The browser's CORS preflight request changes from OPTIONS to GET and the response looks correct as per Postman. However, even though the request appears successful in dev tools, I am unable to access the response via JavaScript due to an Ajax failure message being triggered.
In my scenario, the file that initiates the ajax request is just a simple HTML file with inline JavaScript which I open directly from the file directory. I suspect this might be causing the issue but could not find any explicit information confirming this theory.
It is worth noting that the appropriate access control headers are set for the API being accessed.