0
$ http.postを実行しようとしていますが、この応答でこのエラーが発生します。
XMLHttpRequestはhttp://XXXXXXXXX:2222/server/api/v1/controllersをロードできません。プリフライトの応答が無効なHTTPステータスコード403
を持っている私のすべては、CORSによってその障害が、私は成功しませんこの問題を解決しようとするインターネット・サイスで読みます。
ここは私の$ http.postメソッドです。
// Set the Content-Type
$http.defaults.headers.post["Content-Type"] = "application/json";
// Delete the Requested With Header
delete $http.defaults.headers.common['X-Requested-With'];
var config = {
method: 'POST',
headers: {'Content-Type': 'application/json; charset=utf-8'}
}
$http.post("http://XXXXXXXXX:2222/server/api/v1/controllers", objToSave , config)
.then(function successCallback(response) {
// this callback will be called asynchronously
// when the response is available
console.log(response)
}, function errorCallback(error) {
// called asynchronously if an error occurs
// or server returns response with an error status.
console.log(error)
});
私はAngular v1.5.5を使用しています。私はあなたが私を助けることができると思います
、
よろしく!
CORSエラー=> **側 – Weedoze
この役立ちますあなたの**サーバー上のCORSの設定を確認してください:http://stackoverflow.com/a/38333662/1225328を? – sp00m