错误 对预检请求的响应没有通过访问控制检查:否'访问控制 - 允许 - 来源'
上有标题var myApp = angular.module("myApp", []);
myApp.controller('TestingCtrl', function ($scope, $http) {
var GetData = function () {
$http({
method: "GET",
url: 'http://103.22.11.11/Buses/Sources'
}).success(function (response) {
$scope.Return = response.Id[0];
alert("ddd");
})
}
GetData();
})
我该如何传递此标题
'ConsumerKey': '811D72785AC287ACE3E8',
'ConsumerSecret': 'C80A758DCC6BCEBE436D25BC'
答案 0 :(得分:0)
你有没有试过以下。
var myApp = angular.module("myApp", []);
myApp.controller('TestingCtrl', function ($scope, $http) {
var GetData = function () {
$http({
method: "GET",
url: 'http://103.22.11.11/Buses/Sources',
data:{'dummy':'dummy'},
headers: {'Content-Type':'application/json',
'ConsumerKey': '811D72785AC287ACE3E8',
'ConsumerSecret': 'C80A758DCC6BCEBE436D25BC'}
}).success(function (response) {
$scope.Return = response.Id[0];
alert("ddd");
})
}
GetData();
});