[英]Avoid jquery.validation and use ajaxsumbit + HTML5
I want to send emails from my contact form, I'm using HTML5 form and jquery.validation + jquery.form + jquery1.4.2.我想从我的联系表单发送电子邮件,我使用 HTML5 表单和 jquery.validation + jquery.form + jquery1.4.2。
The form works but I don't like that alert messages when you don't write in a required box, I prefer to use the HTML5 alerts on this case.该表单有效,但我不喜欢在您不写在必填框中时出现的警报消息,我更喜欢在这种情况下使用 HTML5 警报。
How I can avoid jquery.validate and just send the email and give to the client a "done" message.我如何避免 jquery.validate 并只发送电子邮件并向客户端提供“完成”消息。
This is the actual script:这是实际的脚本:
<script>
$(function() {
$('#formulario').validate({
submitHandler: function(form) {
$(form).ajaxSubmit({
url: 'enviar.php',
success: function() {
$('#formulario').hide();
$('#formulario-contacto').append(
"<p>Tu mensaje ha sido enviado correctamente.</p><p><strong>Gracias por contactar conmigo.</strong></p><p>Me pondré en contacto contigo lo antes posible</p><p><a href='contacto.html'>Mostrar Formulario</a></p>"
)
}
});
}
});
});
</script>
instead of using jquery validation use the submit function.而不是使用 jquery 验证使用提交功能。
<script>
$(function(){
$('#formulario').submit(function() {
$(form).ajaxSubmit({
url: 'enviar.php',
success: function() {
$('#formulario').hide();
$('#formulario-contacto').append("<p>Tu mensaje ha sido enviado correctamente.</p><p><strong>Gracias por contactar conmigo.</strong></p><p>Me pondré en contacto contigo lo antes posible</p><p><a href='contacto.html'>Mostrar Formulario</a></p>")
}
});
});
});
</script>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.