如何在Javascript中的http post请求成功时重定向到successs页面
我正在学习如何与我最喜欢的PHP框架(CodeIgniter)一起使用AngularJavaScript。我有一个登录部分,用于验证服务并使用angular js获取响应。代码运行良好。请参阅下面的代码片段如何在Javascript中的http post请求成功时重定向到successs页面,javascript,php,angularjs,codeigniter,codeigniter-3,Javascript,Php,Angularjs,Codeigniter,Codeigniter 3,我正在学习如何与我最喜欢的PHP框架(CodeIgniter)一起使用AngularJavaScript。我有一个登录部分,用于验证服务并使用angular js获取响应。代码运行良好。请参阅下面的代码片段 var login = angular.module('authenticationApp' , ['ngMaterial' , 'ngRoute']) ; login.controller('authenticationController', function ($scope,
var login = angular.module('authenticationApp' , ['ngMaterial' , 'ngRoute']) ;
login.controller('authenticationController', function ($scope, $http) {
$scope.authenticate = function () {
if ($scope.username == undefined || $scope.password == undefined) {
$scope.login_error_message = "All form fields are required" ;
} else {
var url = get_base_url() + 'student/authentication/login?username=' + $scope.username + '&password=' + $scope.password ;
$http.post(url).then(
function (response) {
console.log(response) ;
/*Here I handle success*/
}, function (response) {
$scope.login_error_message = "Service Error!. Response: " + response ;
}
) ;
}
} ;
我的问题是如何将该响应发送到success.php页面并重定向到success页面。我可以使用
window.location.href = get_base_url() + 'administrator/authentication/dashboard' ;
我现在的挑战实际上是将响应发送到这个新位置
提前感谢,如果需要的话,我准备提供更多细节。经过长时间的斗争,我决定使用纯js。差劲但有效