I have encountered an issue with my AngularJS application. I am attempting to send data to a third-party URL for storage on their server. However, when I execute the code below, I receive the following error message: XMLHttpRequest cannot load . Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin ' http://localhost:51491 ' is therefore not allowed access.
The code snippet from my AngularJS factory that is causing the issue:
return $http ({
url : '//thirdparty.url.com',
method :" POST ",
data : params_string,
headers : {
' Access-Control-Allow-Origin ': '* ',
' Access-Control-Allow-Methods ': 'POST, GET, OPTIONS, PUT ',
' Access-Control-Allow-Headers ': 'Origin, X-Requested-With, Content-Type, Accept '
}
});