PageAdmin网站内容管理系统(CMS)交流论坛

注册

 

QQ登录

只需一步,快速开始

发新话题 回复该主题

xiyou大佬看看那里错误呢 [复制链接]

1#
<div class="login-box">
                    <div id="loginBox">
                        
                    </div>
                </div>
                <script type="text/javascript">
                    var userToken;
                    $(function () {
                        $.ajax({
                            url: "http://域名/e/GetUserToken/",
                            type: "GET",
                            xhrFields: { withCredentials: true },
                            dataType: "json", //指定服务器返回的数据类型
                            success: function (data) {
                                if (data != "") {
                                    var redirectUrl = encodeURIComponent(location.href);
                                    var loginedHtml = '<a class="denglu" href="//域名/?redirectUrl=' + redirectUrl + '" target="_blank">登录</a><a class="zhuce" href="//域名/Reg/?redirectUrl=' + redirectUrl + '" target="_blank">注册</a>';
                                    userToken = data.UserToken;
                                    var currentUser = data.CurrentUser;
                                    if (isNullOrEmpty(userToken) || isNullOrEmpty(currentUser)) {
                                        $("#loginBox").html(loginedHtml);
                                        return;
                                    }
                                    var nickName = data.NickName;
                                    if (isNullOrEmpty(nickName)) {
                                        nickName = currentUser.UserName;
                                    }
                                    nickName = nickName.left(10);
                                    loginedHtml = '<a href="http://域名/" class="denglu" title="进入会员中心" target="_blank">您好,' + nickName + '</a>';
                                    $("#loginBox").html(loginedHtml);
                                }
                            }
                        });
                    });
                </script>

运行的以后的结果没任何显示
微信截图_20210110203558.png (, 下载次数:0)

(2021/1/10 20:36:46 上传)

微信截图_20210110203558.png

分享 转发
TOP
2#
TOP
3#

回复 2楼xiyou的帖子

xiyou大佬看看呢
TOP
4#

回复 5楼xiyou的帖子

谢谢!
TOP
发新话题 回复该主题