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

Capture and play voice with Asterisk ARI -

c++ - Can not find the "fiostream.h" file -

visual studio - Installing Packages through Nuget - "Central Directory corrupt" -