javascript - AngularJS Does not send HTTP Post request -
i have following code:
application.controller('userlogincontroller', function($scope,$http){ window.document.title = "user login"; $scope.form = { username: '',password: ''}; $scope.submitlogin = function(){ var config = { method: 'post', url: 'server_app/login.php', data: { 'username' : $scope.form.password, 'password' : $scope.form.password } }; var request = $http(config); request.then(function (response){ $scope.errormessage = response.data; },function(error){ $scope.errormessage = error.data; }) } });
i trying send post request backend server that:
var_dump($_post);
after submitting data button should array $_post back. insteed of get
array (size=0) empty
my html code that:
<input placeholder="login" class="searchproduct" autocomplete="off" name="username" type="text" ng-model="form.username"><br> <input placeholder="password" class="searchproduct" autocomplete="off" type="password" name="password" ng-model="form.password"/> <div class="button" ng-click="submitlogin();">login</div>
i don't see problem here..
i hope receiving data below in php file angular code seems fine .
$params = json_decode(file_get_contents('php://input'),true);
Comments
Post a Comment