2011-08-10 33 views
1

我有一个jQuery模态确认框,我添加了一个注册和登录按钮(我刚刚从手册中复制了一个)..现在的问题是,jquery模态确认框的按钮功能,请帮忙吗?

1)一旦我点击注册按钮,我想显示另一个弹出框,这弹出, 应包含这阿贾克斯供电模块

  <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),那么一旦阿贾克斯供电模块弹出出现时,确认框关闭。
3)当用户注册成功后,如何关闭这个新弹出窗口并自动刷新页面,因为我应用中的每个注册用户都应该自动登录。

这里是我的确认框代码

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; 
} 

回答

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

我编辑我的第一篇文章,你可以请,怎么做我想做的,jQuery的模态确认框,我有内? – sasori

+1

看看这个小提琴:http://jsfiddle.net/AlienWebguy/axLPE/ – AlienWebguy