Here is my app.js, I want to send the value of email
to the file handler.php
$scope.doForget={email:''};
$scope.doForget = function (customer) {
//email = $scope.forget.email; For Testing i am hardcoding the value
email = 'abc@xyz.com';
Data.post('handler.php', {
email: email
}).then(function (results) {
console.log(results);
});
};
In the Inspect Element -> Networks i can see the form values as {email: "abc@xyz.com"}
In the handler.php
i use to print the values by print_r($_POST);
and even print_r($_GET);
but i am always getting the empty array i.e.,
Array
(
)
How can i get the values ?
Update :
I even tried this one
$scope.doForget={email:''};
$scope.doForget = function (email) {
email = 'abc@xyz.com';
Data.post('eloquent.php', {
email: email
}).then(function (results) {
console.log(results);
});
};
Just use in angular's controller :
var emailNew = "demo@demo.com";
$http({
method : 'POST',
url : 'relative_path_to_demo.php',
data : {"email" : emailNew}
})
and in your server PHP file. Put code
$data = file_get_contents("php://input");
$objData = json_decode($data);
$email = $objData -> email; // Get your email