2014-04-29 140 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 
}