【发布时间】:2013-11-27 22:41:25
【问题描述】:
我只是不明白为什么此表单会发送同一电子邮件的多个副本(从 1 到 8 个副本)。我已经尽力解决问题,但我无法解决。
我正在使用 jQuery Validation Engine 来验证表单,如果验证正确,我使用 jquery.post() 来提交表单。
为了安全起见,我已经包含了我的所有代码。但是这里有些东西可能无关紧要,比如当消息发送成功时我在 iframe 中加载的 ppcconversion 脚本。
请看下面的代码:
$(".consult-form form .submit").click(function(){
$(".consult-form form").validationEngine('attach', {
promptPosition : "topLeft",
onValidationComplete: function(contactForm, status){
if(status==true){
$(".consult-form form .submit").clone().insertAfter($(this)).attr("disabled","true");
$(".consult-form form .submit").hide();
_gaq.push(['_trackPageview', '/web-contact']); // Google Page Tracker
$.post('/path/to/process.php', $(".consult-form form").serialize(), function(data) {
// Add Thank You Message
$('.thank-you-message').html(data);
// Create IFRAME to page with Adwords Tracking Script
function ppcconversion() {
var iframe = document.createElement('iframe');
iframe.style.width = '0px';
iframe.style.height = '0px';
document.body.appendChild(iframe);
iframe.src = 'http://www.fullurlto.com/conversion-script.php';
};
ppcconversion();
});
return false; // I attempted to add this line to prevent it from submitting multiple times. It didn't work.
$(".consult-form form").hide();
}
}
});
});
如果您需要任何其他详细信息以了解更多信息,请告诉我,我会提供。
谢谢!
【问题讨论】:
标签: jquery ajax forms validation post