Javascript 在Angulars.js中使用$post参数发送

Javascript 在Angulars.js中使用$post参数发送,javascript,angularjs,http,post,Javascript,Angularjs,Http,Post,我尝试使用$HTTPPOST和Angulars.js发送一个可手持的表数据 代码如下: var $container = $("div#table"); var handsontable = $container.data('handsontable'); $scope.saveData = function() { $http.post('save.php', {'data':handsontable.getData()}).succes

我尝试使用$HTTPPOST和Angulars.js发送一个可手持的表数据 代码如下:

 var $container = $("div#table");         
 var handsontable = $container.data('handsontable');
 $scope.saveData = function() {
                $http.post('save.php', {'data':handsontable.getData()}).success(function(res,status) {
                      if (res.result === 'ok') {
                        console.log('Data saved');
                      }
                      else {
                        console.log('Save error');
                      }
                });
 }
但是我得到了一个“保存错误”

Undefined index: data in <b>C:\xampp\htdocs\angular\save.php
我更改了$http.post中的参数以使其正常工作,但没有解决方案,
谢谢你给我一些建议

我终于在这里找到了解决方案:[

而不是以这种方式检索数据

$values=$_POST['data'];
我这样说:

$request_body = file_get_contents('php://input');

请求负载不正确,缺少一个
]
$request_body = file_get_contents('php://input');