2011-06-14 144 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,这是我的形式需要。

谢谢!