首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >jquery模式确认框功能,请帮帮忙?

问jquery模式确认框功能,请帮帮忙?
EN

Stack Overflow用户
提问于 2011-08-10 22:29:00
回答 1查看 367关注 0票数 1

我有一个jquery模式确认框,我添加了一个注册和登录按钮(我只是从手册中复制了一个)..now问题是,

1)单击注册按钮后,我想显示另一个弹出框,该弹出框将包含此ajax驱动的模块

代码语言:javascript
复制
          <div id="registerpopup">
            <?php
            if($_GET['t']=='l')
                {
                    $the_class->Lostpword('pword_embed');
                }
            elseif($_GET['t']=='b')
                {
                    $the_class->Lostpword('unamepword_embed');
                }
            elseif($_GET['t']=='n')
                {
                    //$the_class->Lostpword('pword_embed');
                    $the_class->Registration('unamepword_embed_next');
                }
            elseif($_GET['t']=='r')
                {
                    //$the_class->Lostpword('pword_embed');
                    $the_class->Registration('register_embed');
                }
            else
                {
                    $the_class->Lostpword('accn_help');
                }
                ?>
          </div>

2)一旦ajax驱动的模块出现,确认框就会关闭。

3)当用户注册成功后,如何关闭这个新的弹窗并自动刷新页面,因为我的app中的每个注册用户都应该自动登录。

这是我的确认框代码

代码语言:javascript
复制
 if(userid == ""){
        $( "#dialog:ui-dialog" ).dialog( "destroy" );

        $( "#dialog-confirm" ).dialog({
            resizable: false,
            height: 230,
        width: 350,
            modal: true,
            buttons: {
                "Register": function(){
                $(this).dialog("close");
                },
                "Log in": function() {
                    $(this).dialog("close");
                }
            }
        });
    return false;
 }
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2011-08-10 22:35:58

代码语言:javascript
复制
// Inside confirm modal code
// On click of register button...
$('#confirm_register_btn').click(function(){
    // ... close the confirm box
    $('#confirm_box').hide();
});

// Inside register modal code
$.ajax({
    url: '/path-to-register.php',
    data: ...
    dataType: ...
    type: 'post',
    success:function(data){
        // Example, data = 'Registration successful'
        // Let the user know...
        $('body').html(data + ' -- Please wait while we redirect you');

        // Reload page
        window.location.reload();
    }
});
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/7012433

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档