我正在测试angularjs的简单ajax请求,它似乎不工作。请求已经完成,我得到200,但数据没有通过。为什么ajax请求的数据使用angularjs为空?
$http({
url: "myphp.php",
method: "GET",
dataType: "json",
data: {"foo":"bar"}
}).success(function(data, status, headers, config) {
console.log(data);
}).error(function(data, status, headers, config) {
$scope.status = status;
});
<?php
echo var_dump($_GET);
?>
与get和post相同的结果。如果我试图访问$ _GET ['foo']例如,我得到一个未定义的索引异常。
我在做什么错?
什么是PHP的回报?回应的内容是什么? – 2013-03-02 04:16:33
http://plnkr.co/edit/SEezJCY7ngBWy6W0IuJW如果这并不令人满意,请解释一下,如果可以的话,我怎样才能获得更多的信息使用php5.4内置的http服务器@CaioToOn – user2057574 2013-03-02 13:34:27