2011-08-10 31 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