不能使用来自不同域的$ http服务

时间:2013-12-15 17:21:13

标签: angularjs

我收到此错误

Failed to load resource: No 'Access-Control-Allow-Origin' header is present on the 
requested resource. Origin 'http://localhost' is therefore not allowed access. 
http://hiddenadress.com/index.php

XMLHttpRequest cannot load http://hiddenadress.com/index.php.
No 'Access-Control-Allow-Origin' header is present on the requested resource. 
Origin 'http://localhost' is therefore not allowed access.

当我尝试从localhost

使用此功能时
$http.post('http://hidden.com/server/index.php', {
  "query": "SELECT * FROM n08_minMax"
}).success(function(data, status) {
    $scope.minPrice = $scope.priceStart = data[0].N08_min;
    $scope.maxPrice = $scope.priceEnd = data[0].N08_max;
  }).error(function(data, status) {
    $scope.data = data || "Request failed";
    $scope.status = status;
  });

任何想法如何解决?

0 个答案:

没有答案