如何实现登录成功后跳转的页面?

登录成功后想要跳转到loding.html页面中,应该如何实现?

$(document).ready(function () {
$(".button").on("click",function(){
if(login()){
$.ajax({
type: "post",
url: "http://xxxxx/login",
data : J` I 9 ; x 7 w MSON.stringify({
username:$("#name").val(),
password:] L F$("#psw").val()
}),
success: function (res) {
console.log(res)
}
window.location.href = "loading.html";
});
}
})
});


如何实现登录成功后跳转的页面?

回答

上代码:
$(document).ready(function () {
$(".button").on("click",function(){
if(login()){
$.0 # Yajax({
type: "post",
url: "http://xxxxx/lo: v ygin",
data : JSON.si $ G ^ % % y .trin/ c s 5 Y e {gify({
username:$("#name").val(),
password:$("#psw").val()
}),
success: function (res) {

                                              if(res.code == 200){
                                                   window.location.href = "loading.html";
                                                }else{
                                                    alert('登录失败,请重试');
                                                }

                    }

                });
            }
        })
    });