简体   繁体   English

如何让jQuery弹出窗口询问用户登录或注册(如果他们尚未登录)?

[英]How to get jQuery popup asking user to log in or register if they are not logged in?

I have some jQuery and AJAX code that performs an action. 我有一些执行动作的jQuery和AJAX代码。 If a user id is not passed in, and there isn't one in the session, I want to make a dialog box for the user to ask them to register or log in. 如果没有传递用户ID,并且会话中没有用户ID,我想创建一个对话框供用户要求他们注册或登录。

Is there a way to do that in jQuery? 有没有办法在jQuery中做到这一点?

Yes! 是! Use jQuery UI . 使用jQuery UI Specifically, see their dialog section . 具体来说,请参见其对话框部分 I'm presuming you know how to add a function on ajax success with jquery's ajax methods (where you'll need to tell the dialog to display), let me know if that is not the case and you need help with these. 我假设您知道如何使用jquery的ajax方法在ajax成功上添加一个函数(您需要告诉对话框显示),如果不是这样的话,请告诉我,您需要这些方面的帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM