JavaScript中ajax请求成功回调函数中进行页面无法进行跳转

ajax代码,/index是跳转的界面


<script src="/js/jquery-3.3.1.js"></script>
<script type="text/javascript">
    // 登录事件
    function enter() {
        // 获取用户输入的账号
        var name = document.getElementById("tel").value;
        console.log(tel);
        // 获取用户输入的密码
        var pas = document.getElementById("pas").value;
        console.log(pas);
        var data1 = {"username": name, "password": pas};
        $.ajax({
            url: '/user/login',
            data: JSON.stringify(data1),
            type: "post",
            async:false,
            contentType: "application/json;charset=utf-8",
            dataType: "json", //表示返回值类型,不必须
            success: succFunction,//响应成功后的回调函数
            error: errorfunction//表示如果请求响应出现错误,会执行的回调函数
        });

        function succFunction(data) {
            var username = data.data.username;
            var status = data.data.status;
            console.log(username+";"+status);
            if (data.code == 0) {
                //登录成功
                //页面跳转
           window.location.href='/index';
                console.log("成功");
            } else if (data.code == -1) {
                return false;
            }
            function errorfunction() {
                console.log("失败");
            }
        }
    }
</script>
<footer>
    <div id="message-box"></div>
</footer>
</html>

这样试一下请求成功是否可以跳转

 
<script src="/js/jquery-3.3.1.js"></script>
<script type="text/javascript">
    // 登录事件
    function enter() {
        // 获取用户输入的账号
        var name = document.getElementById("tel").value;
        console.log(tel);
        // 获取用户输入的密码
        var pas = document.getElementById("pas").value;
        console.log(pas);
        var data1 = {"username": name, "password": pas};
        $.ajax({
            url: '/user/login',
            data: JSON.stringify(data1),
            type: "post",
            async:false,
            contentType: "application/json;charset=utf-8",
            dataType: "json", //表示返回值类型,不必须
            success: succFunction(data),//响应成功后的回调函数
            error: errorfunction//表示如果请求响应出现错误,会执行的回调函数
        });
        function succFunction(data) {
            var username = data.data.username;
            var status = data.data.status;
            console.log(username+";"+status);
            if (data.code == 0) {
                //登录成功
                //页面跳转
           window.location.href='/index';
                console.log("成功");
            } else if (data.code == -1) {
                return false;
            }
            function errorfunction() {
                console.log("失败");
            }
        }
    }
</script>
<footer>
    <div id="message-box"></div>
</footer>
</html>

succFunction没传参过去