Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/370.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/283.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何在Javascript中的http post请求成功时重定向到successs页面_Javascript_Php_Angularjs_Codeigniter_Codeigniter 3 - Fatal编程技术网

如何在Javascript中的http post请求成功时重定向到successs页面

如何在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,

我正在学习如何与我最喜欢的PHP框架(CodeIgniter)一起使用AngularJavaScript。我有一个登录部分,用于验证服务并使用angular js获取响应。代码运行良好。请参阅下面的代码片段

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。差劲但有效