您的位置:首页 > Web前端 > AngularJS

AngularJS报错No 'Access-Control-Allow-Origin' header

2016-06-28 16:44 519 查看
报错:

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:63342' is therefore not allowed access. The response had HTTP
status code 403.

解决方式:

angular.module('com.budee.award').controller('formController', function ($scope,$http) {
$scope.formData = {};
$scope.processForm = function () {
console.log("测试一下"+$scope.formData);
$http({
url:'http://1.iyyren.com/api/prize/111/record/save',
method:"POST",
<strong><span style="color:#ff0000;">headers: {
'Content-Type': 'application/x-www-form-urlencoded'
},</span></strong>
data: $scope.formData
})
}
});
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: