AngularJS HTTP POST到PHP和未定义
ng-submit="login()
function LoginForm($scope, $http){
$http.defaults.headers.post['Content-Type'] = 'application/x-www-form-urlencoded; charset=UTF-8';
$scope.email = "fsdg@sdf.com";
$scope.password = "1234";
$scope.login = function()
{
data = {
'email' : $scope.email,
'password' : $scope.password };
$http.post('resources/curl.php', data)
.success(function(data, status, headers, config)
{
console.log(status + ' - ' + data);
})
.error(function(data, status, headers, config)
{
console.log('error');
});
}}emailpassword
<?php $email = $_POST['email'];$pass = $_POST['password'];echo $email;?>
POST
编辑
.success.error.then
慕雪6442864
杨魅力
智慧大石
沧海一幻觉
随时随地看视频慕课网APP