dongtou9934 2015-07-29 17:36
浏览 30
已采纳

Angularjs POST URL数据到PHP并打印响应

I have written the code but not getting output. How can I print the output on the page using AngularJS?

When I am using the dynamic URL, the active link color change isn't working.

// Grab path parameters and query parameters
var routeParameters = $routeParams;
$scope.pageParameter = (routeParameters["pageParam"] || "No page parameter");
$scope.queryParameter = (routeParameters["queryParam"] || "No query parameter");

// Do an $http call to your site
$http({
    url: "http://keralapsctuts.com/app/index.php",
    method: "POST",
    data: {
        param1: $scope.pageParameter,
        param2: $scope.queryParameter
    }
}).success(function(response) {
    $scope.values = reponse;
});
  • 写回答

2条回答 默认 最新

  • douxing6434 2015-07-29 18:44
    关注

    The response object represents your HTTP response coming back. I think you should only be assigning the data to you scope values property. So update it like so:

    .success(function(response){
        $scope.values = reponse.data;
        console.log($scope.values); // print to console.
    });
    

    If you want to display in the view, @tokkov show how in his answer.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥30 关于#r语言#的问题:如何对R语言中mfgarch包中构建的garch-midas模型进行样本内长期波动率预测和样本外长期波动率预测
  • ¥15 ETLCloud 处理json多层级问题
  • ¥15 matlab中使用gurobi时报错
  • ¥15 这个主板怎么能扩出一两个sata口
  • ¥15 不是,这到底错哪儿了😭
  • ¥15 2020长安杯与连接网探
  • ¥15 关于#matlab#的问题:在模糊控制器中选出线路信息,在simulink中根据线路信息生成速度时间目标曲线(初速度为20m/s,15秒后减为0的速度时间图像)我想问线路信息是什么
  • ¥15 banner广告展示设置多少时间不怎么会消耗用户价值
  • ¥15 可见光定位matlab仿真
  • ¥15 arduino 四自由度机械臂