This is my code :
var req = {
method: 'GET',
headers: {
'Access-Control-Allow-Origin': '*'
},
url: '~my url~'
}
$http(req).success(function(data) {
console.log(JSON.stringify(data));
window.location = "myPage.html";
})
.error(function(data) {
alert('Login Failed');
});
I have included Access-Control-Allow-Origin
in the header, but I still get the following error :
Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource. (Reason: CORS header 'Access-Control-Allow-Origin' missing).
What is wrong with my code?