决赛:AJAX / jQuery的/ PHP表单提交和模态对话框成功开 [英] Final: AJAX/jQuery/PHP Form submission and modal box open on success
问题描述
由于萨穆埃尔Liew和其他伟大的帮手,这一问题已得到修复。
Thanks to Samuel Liew and other great helpers, the issue has been fixed.
由于把这里的一切是一个烂摊子,它是在整体解决方案解释不清,我dediced做出解释在我自己的网站。
As putting everything here was a mess, and it was poorly explained in the overall solution, I dediced to make a explanatory in my own web site.
我离开DEMO给你看,如果这就是你要找的内容,和我离开教程让你学习如何做到这一点。
I leave the DEMO for you to see if that's what you're looking for, and I leave the TUTORIAL for you to learn how to do this.
教程: http://santz.com.ar /博客/ AJAX的形式提交开模态盒/
演示: http://santz.com .ar /文件/演示/ AJAX的形式提交开模态盒/
希望我帮你!感谢所有那些帮助我!
Hope I helped you! Thanks to all the ones that helped me!
@Samuel与Liew,和其他伟大的帮手。该问题已得到修复。我会离开corected code为未来的家伙需要这个。
@Samuel Liew, and other great helpers. THE ISSUE HAS BEEN FIXED. I'll leave corected code for future guys that need this.
案例: http://santz.net/index.contacto。 HTML (不再提供)
这就是问题:
目标:网站必须成功的表单提交后,打开一个对话框/模盒/模态窗口
Target: The "website" must open a dialog/modal box/modal window after successful form submission.
问题:的形式成功提交,但该对话框/模盒/模态窗口没有打开(很少,但它却可以,如果你做 再点击一下,...)
Issue: The form submits successfully but the dialog/modal box/modal window doesn't open (rarely, it does open if you make another click...)
[试试吧,这就是为什么我给你的链接。没有任何问题,在网站上 是我的,我收到消息]
[Try it, that's why I gave you the link. There's no problem, the site is mine and I recieve the messages]
我希望你能帮助我...的想法很简单!当用户提交表单,一个对话框popsup瞬间!
非常感谢!
推荐答案
在此情况下,将提交功能之外的对话功能:
In this case, move the dialog function outside of the submit function:
$(function() {
$('#popup-wrapper').modalPopLite({
openButton: '#clicker',
closeButton: '#close-btn'
});
$('#contact-form').submit(function() {
$.ajax({
type: "POST",
url: $(this).attr('action'),
data: $(this).serialize(),
success: function() {
$('#contact-form')[0].reset();
}
});
return false;
});
});
这篇关于决赛:AJAX / jQuery的/ PHP表单提交和模态对话框成功开的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!