ajax 请求登录成功后,返回上个浏览界面

if(data.result=="success"){

    var prevLink = document.referrer; 
    console.log(prevLink);
    if($.trim(prevLink)==''){  
        location.href = '/';  
    }else{
        if($.trim(prevLink)=='http://localhost/login.jsp'){
            location.href = '/';
        }else if($.trim(prevLink)=='http://localhost/register.jsp'){
            location.href = '/login.jsp';
        }else{
            location.href = prevLink;
        }
    
    }
    
}

 

posted @ 2019-01-02 11:19  格鲁特baby  阅读(257)  评论(0编辑  收藏  举报