I have this POST request that can't go through. I have no problem making a GET or even PUT request, but the POST just appears as Cancelled in chrome dev tools.
$http({
url: 'https://dev.myapp.com/classes/app/',
method: 'POST',
data: scope.original,//already tried to stringify and angular.json, etc. But it should work like this
headers: {
"X-app-Api-Key": scope.apiKeys['X-app-Api-Key'],
"X-app-App-Id": scope.apiKeys['X-app-App-Id']
}
}).success(function(response) {
console.log('ok');
});
I can get it to work if I use jQUery's $.ajax:
$.ajax({
url: "https://dev.myapp.com/classes/app/",
headers: {
"X-app-Api-Key":"key",
"X-app-App-Id":"key"
},
type: "POST",
data: JSON.stringify({some: 'object'}),
success: function(r) {console.log('ok');
}
});
But chrome just returns this when using angular's $ http
:
XMLHttpRequest cannot load https://dev.myapp.com/classes/app/. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin http://localhost:8000
is therefore not allowed access.