How to fix “Cross-Origin Request Blocked” error

I had this problem when I am in the process of migrating my web services files into another server. My web services files on where the third party users connect to my application suddenly stopped working and had this error when connecting to them:

Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at [URL_HERE]
(Reason: CORS header ‘Access-Control-Allow-Origin’ missing).

What I had done is to add these additional response headers into my receiving files(meaning the one that receives and process the data).


You can see the different kinds of HTTP request methods here and use whatever suits your application needs.

cross-origin request blocked jquery ajax php javascript, cross origin request blocked reason cors header access control allow origin missing, enable CORS php jquery ajax javascript