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

注册

 

QQ登录

只需一步,快速开始

发新话题 回复该主题

求解,这个代码缺少什么东西 [复制链接]

1#
<div class="login-box"><div id="loginBox">   </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 href="//(域名)/?redirectUrl=' + redirectUrl + '" class="denglu" target="_blank">登录</a><a href="//(域名)/Reg/?redirectUrl=' + redirectUrl + '" class="zhuce" 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></div>
分享 转发
TOP
2#

回复 2楼xiyou的帖子

网站运行以后,网页不显示登录和注册按钮。是缺少什么前置的代码吗?
TOP
发新话题 回复该主题