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

Popular posts from this blog

ruby - Trying to change last to "x"s to 23 -

jquery - Clone last and append item to closest class -

css - Can I use the :after pseudo-element on an input field? -