我开始使用angularJS,我开始学习一个程序,但我不明白为什么我发送时没有收到$ _POST变量
这是我的控制器代码
var ModalInstanceCtrl = function($scope,$http, $modalInstance, $modal, Name, Country, City) {
$scope.Name = Name;
$scope.City = City;
$scope.Country = Country;
$scope.ok = function (Name,Country,City) {
Country = 'test';
$http.post('requete.php', Country)
.success(function (reponse) {
$scope.PostDataResponse = reponse;
})
.error(function (status) {
alert(status);
$scope.ResponseDetails = "Data";
});
};
$scope.cancel = function () {
$modalInstance.dismiss('cancel');
};
}
这是我的requete.php
<?php
header("Content-Type: application/json; charset=UTF-8");
var_dump($_POST);
echo 1;
?>
modal.html
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header-info">
<button type="button" class="close" ng-click="cancel()"></button>
<h4 class="modal-title">Envoyer un SMS</h4>
</div>
<div class="modal-body">
{{PostDataResponse}}
<div class="col-md-12">
<spam class="spamcenter">Nom : {{Name}}</spam>
<br>
<spam class="spamcenter">Pays : {{Country}}</spam>
<br>
<spam class="spamcenter">Ville : {{City}}</spam>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" ng-click="cancel()">Close</button>
<button type="button" class="btn btn-primary" ng-click="ok(Name,Country,City)">Envoyer</button>
</div>
</div><!-- /.modal-content -->
</div><!-- /.modal-dialog -->
这是我的回应变量
<?php header("Content-Type: application/json; charset=UTF-8"); var_dump($_POST); echo 1; ?>
它返回了我文件的所有代码
我不明白为什么,我在控制台网络中看不到POST的痕迹
有人可以帮助我
提前致谢