2011-06-14 138 views
0

我已經搜查,可以找到的東西,幾乎看起來他們的工作,但我似乎不能這麼在這裏找到一個明確的答案去...jQueryUI的對話框和表格處理

使用這個代碼,我有一個jQueryUI模式窗口顯示...

<script> 
jQuery(function() { 
$("#dialog").dialog({ closeOnEscape: true, modal: true, draggable: false, resizable: false, width: 500, height: 500, close: function(event, ui) { location.href = 'http://www.page.com' } }); 
}); 
</script> 
<div id="dialog" title="WELCOME!"> 
<form id="wp_signup_form" action="" method="post"> 
<label>Email address</label><br /> 
<input type="text" name="email" class="text" value="" /> <br /> 
<input type="submit" id="submitbtn" name="submit" value="SignUp" /> 
</form> 
</div> 

但是,當我點擊窗體提交整個頁面重新加載模態窗口內。

如何獲取模式窗口重新加載其中的表單內容(還有一些PHP我會在這之後添加)或重新加載整個頁面?

謝謝! 克里斯

+0

我懷疑你的表單動作需要調用一個不同的頁面(比如'formhandler.php'),或者可能需要添加一個'target =「_ top」'將表單加載到整個頁面。不知道我是否完全掌握了這個問題。 – artlung 2011-06-14 19:31:25

+0

我試過raget =「_ top」,但沒有骰子。當我點擊中檔窗口提交後,整個頁面(後臺頁面)將重新加載到模態窗口中。 – 2011-06-14 19:51:29

回答

0

我解決了這個通過加載我的模態窗口內的iFrame:

$(document).ready(function() { 
     $("#modalIframeId").attr("src","http://site.com/wordpress/wp-content/themes/theme/registration.php"); 
     $("#divId").dialog({ 
       autoOpen: true, 
       modal: true, 
       closeOnEscape: true, 
       draggable: false, 
       resizable: false, 
       dialogClass: 'no-close', 
       height: 500, 
       width: 500, 
       title: 'Sign Up' 
      }); 
    }); 
     </script> 

    <div id="divId" title="Dialog Title"> 
     <iframe id="modalIframeId" width="100%" height="100%" 
     marginWidth="0" marginHeight="0" frameBorder="0" scrolling="none" 
     title="Dialog Title">Your browser does not suppr</iframe> 
    </div> 

,並呼籲爲registration.php到的iframe,這是我的形式需要。

謝謝!