使用Magnific Popup在模态窗口中显示窗体响应 [英] show the form response in modal window using Magnific Popup

查看:589
本文介绍了使用Magnific Popup在模态窗口中显示窗体响应的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用ajax提交表单,并使用Magnific Popup在模式窗口上显示响应。我已经发布了下面的代码。在关于使其工作,我必须点击发送按钮,然后弹出按钮。我在过去的3个小时里一直在玩,无法使它工作。你能看看我做错了什么吗?我想点击发送按钮,并在模态弹出窗口中看到php响应。

 < html> 
< head>
< script src =https://cdnjs.cloudflare.com/ajax/libs/jquery/1.11.2/jquery.min.js>< / script>
< script src =https://rawgit.com/dimsemenov/Magnific-Popup/master/dist/jquery.magnific-popup.js>< / script>
< script type =text / javascript>
jQuery(document).ready(function(){
$ b $(document).on('click','.popup-modal',function(e){

$(#indexform).on(submit,function(event){
event.preventDefault();
var formdata = $(this).serialize();
$ .ajax({
type:POST,
url:result.php,
data:formdata,
success:function(msg){
$(#modal-results)。html(msg)


错误:function(){
alert(failure);

});
});


});

$('。popup-modal')。 magnificPopup({
type:'inline'

});
});
< / script>
< link rel =stylesheethref =https://rawgit.com/dimsemenov/Magnific-Popup/master/dist/magnific-popup.css>
< style>
div#modal-results {
color:white;
}
< / style>
< / head>
< body>
< form method =postname =indexid =indexform>
< input type =textname =nameplaceholder =NAME>
< input type =textname =emailplaceholder =EMAIL>