2014-04-29 95 views
0

尝试将magnific popup用于单页网站,并根据需要显示窗体。弹出式窗体不会自动提交 - 使用大型弹出式窗口

像这样调用外部文件弹出窗口。

<a href="myformx.php" class="simple-ajax-iframe">form</a> 

<script type="text/javascript"> 
$(document).ready(function(){ 

    $('.simple-ajax-iframe').magnificPopup({ 
     type: 'iframe' 
    }); 

    $('.simple-ajax-popup').magnificPopup({ 
     type: 'ajax' 
    }); 

}); 
</script> 

<form name="form1" method="POST" action="myformx.php"> 

<label>Your first name:</label> 
<input class="formfield" name="your_name" type="text" value="" size="20"> 

<input class="submit" type="image" 
    id="Submit" name="Submit" value="Submit" 
    src="images/but_send.jpg" 
style="width: 97px; height: 51px;"> 

表啪啪 - 真棒...... 表单提交空白出什么 - 不是真棒。

想要确定如何在弹出窗口中更好地提交自己。已经尝试了几种可能性 - 没有任何效果不可能那么困难 - 我在这里以某种方式忽略了这个明显的问题。

回答

1

已解决。用它来操作和命名表单。注意名称=“my_form”。在表单标签上使用target =“my_form”来获得后置变量提交给自身。希望这可以帮助别人。

$('.simple-ajax-iframe').magnificPopup({ 
    type: 'iframe', 

    iframe: { 
    markup: '<div class="mfp-iframe-scaler">'+ 
     '<div class="mfp-close"></div>'+ 
     '<iframe class="mfp-iframe" name="myform" frameborder="0" allowfullscreen> </iframe>'+ 
     '</div>', // HTML markup of popup, `mfp-close` will be replaced by the close button 
}