Jquery模态确认框按钮功能,请帮忙


jquery modal confirm box button functionality, help please?

我有一个jquery模态确认框,我添加了一个注册和登录按钮(我只是从手册中复制了一个)。现在的问题是,

1)一旦我点击注册按钮,我想要显示另一个弹出框,这个弹出框,应该包含这个ajax动力模块

          <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中每个注册的用户都应该自动登录。

这是我的确认框代码

 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;
 }
// 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();
    }
});