$route3 = $r->post("/api",function() use($request){
$myarray = array('bar' => 'foo','foo' =>'bas'); // test to see if response can actually return something
$post = $request->request->all(); is parameterBag from Symfony
if (count($_POST) == 0) { // raw post array
throw new Exception("Error Processing ". print_r($_POST,true), 1);
I try to make a post request and all works fine, the route is accessed, but the $_POST in php stays empty
from angularJS $http.post("/api", {"foo":"bar"}) .success(function(data, status, headers, config) { $scope.data = data; console.log(data); }).error(function(data, status, headers, config) { $scope.status = status; });
$route3 = $r->post("/api",function() use($request){ $myarray = array('bar' => 'foo','foo' =>'bas'); // test to see if response can actually return something $post = $request->request->all(); is parameterBag from Symfony if (count($_POST) == 0) { // raw post array throw new Exception("Error Processing ". print_r($_POST,true), 1);
} return new JasonResponse($_POST);