I am calling a $http.post function but can not grab the data on the other side, the calls goes through successfully but can not retrieve the data in my PHP script
AngularJS:
var data = {
firstname: $scope.first_name,
lastname: $scope.last_name,
email : 'test@fff.com',
user : userID
};
var config = {
headers : {
'Content-Type': 'application/x-www-form-urlencoded;charset=utf-8;'
}
}
$http.post('http://xxx-env.us-east-1.elasticbeanstalk.com/apipost/updateusersetting/user/'+userID, data, config).success(function (data, status, headers, config) {
alert('yay'); // this works and gets called
})
.error(function (data, status, header, config) {
});
Server side PHP:
$data = json_decode(file_get_contents("php://input"));
$email = $data->email;
$user = $data->user;
$firstname = $data->firstname;
$lastname = $data->lastname;
Also tried this, doesnt work either
$email = $_POST['email'];
$user = $_POST['user'];//$data->user;
$firstname = $_POST['firstname']; //$data->firstname;
$lastname = $_POST['lastname']; ;//$data->lastname;
