angularjs - http POST data access -
i'm new anuglarjs , trying send http post request. request sent successfully. however, cannot access post data on server side. i've tried modify headers , request data (per different articles). none seem work. here's using,
client:
var user = { name: $scope.username }; $http({ method: "post", url: "../validation", data: user, }).then(function(response) { console.log(response); });
server:
$postdata = file_get_contents("php://input"); $request = json_decode($postdata); $name = $request->name; echo $name;
any appreciated. thanks!
Comments
Post a Comment