javascript - Form value not passing in angularjs -
here app.js, want send value of email
file handler.php
$scope.doforget={email:''}; $scope.doforget = function (customer) { //email = $scope.forget.email; testing hardcoding value email = 'abc@xyz.com'; data.post('handler.php', { email: email }).then(function (results) { console.log(results); }); };
in inspect element -> networks can see form values {email: "abc@xyz.com"}
in handler.php
use print values print_r($_post);
, print_r($_get);
getting empty array i.e.,
array ( )
how can values ?
update :
i tried 1
$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 server php file. put code
$data = file_get_contents("php://input"); $objdata = json_decode($data); $email = $objdata -> email; // email
Comments
Post a Comment