-1
我做了一個Ajax GET請求,我得到這個錯誤:
XMLHttpRequest cannot load http://domains.bootname.com/api/v1/domain/test. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:8000' is therefore not allowed access.
我不知道怎麼樣要解決這個問題......這是我的JS:
var myApp = angular.module('myApp', []);
myApp.controller('mainController', function($scope, $http){
$scope.message = "hello";
var myDomain = $scope.myDomain;
$scope.searchDomain = function(myDomain){
$http.get('http://domains.bootname.com/api/v1/domain/' + myDomain, {
type: 'GET',
dataType: 'JSONP',
success: function(results){
console.log(results)
}
})
}
});
'domains.bootname .COM '必須發送必要的HTTP頭來允許這個。 – CBroe 2014-11-22 23:00:26