如何将验证引擎js与jQuery AJAX和PHP电子邮件提交集成?
我正在使用 https://github.com/posabsolute/jQuery-Validation-Engine
验证有效,但 AJAX 不起作用...... 问题是它对我来说很多次都不起作用,我尝试这样做但失败了30多次,我不知道为什么,他的AJAX提交php示例对我没有用......
有我的脚本来验证表单:
$("#formID").validationEngine({promptPosition : "centerRight", scroll: false, ajaxFormValidation: true});
有一个我想与验证引擎集成的 jQuery AJAX 脚本:
$.ajax({
type: "POST",
url: "send.php",
data: sendData,
beforeSend: function () {
$("#ajax").show();
},
success: function () {
$('#listo').html("<p>Thank you!</p>")
.hide()
.fadeIn(1000, function () {
});
}
});
还有另一个我的 PHP 脚本来发送数据表单:
function send_email() {
$message = "\nNombre: " . $_POST['nombre'] .
"\nEmail: " . $_POST['email'] .
"\nMensaje: " . $_POST['message'] .
"\nTélefono: " . $_POST['tel'];
$message .= "\n\nBrowser Info: " . $_SERVER["HTTP_USER_AGENT"] .
"\nIP: " . $_SERVER["REMOTE_ADDR"] .
"\n\nDate: " . date("Y-m-d h:i:s");
$siteEmail = '[email protected]';
$emailTitle = 'Contact from your website';
$thankYouMessage = "succesful sent.";
if(! mail($siteEmail, $emailTitle, $message, 'From: ' . $_POST['nombre'] . ' <' . $_POST['email'] . '>'))
echo 'cannot send...';
}
任何人都可以帮助我吗?
I am using from https://github.com/posabsolute/jQuery-Validation-Engine
The validation worked, but AJAX didn't work...
The problem is that it didn't work to me many times, i tried to do it but it failed more than 30 times, i don't know why, his AJAX submit php example isn't useful to me...
There is my script to validate the form:
$("#formID").validationEngine({promptPosition : "centerRight", scroll: false, ajaxFormValidation: true});
There is my jQuery AJAX script that i want to integrate with Validation Engine:
$.ajax({
type: "POST",
url: "send.php",
data: sendData,
beforeSend: function () {
$("#ajax").show();
},
success: function () {
$('#listo').html("<p>Thank you!</p>")
.hide()
.fadeIn(1000, function () {
});
}
});
And there another my PHP script to send data form:
function send_email() {
$message = "\nNombre: " . $_POST['nombre'] .
"\nEmail: " . $_POST['email'] .
"\nMensaje: " . $_POST['message'] .
"\nTélefono: " . $_POST['tel'];
$message .= "\n\nBrowser Info: " . $_SERVER["HTTP_USER_AGENT"] .
"\nIP: " . $_SERVER["REMOTE_ADDR"] .
"\n\nDate: " . date("Y-m-d h:i:s");
$siteEmail = '[email protected]';
$emailTitle = 'Contact from your website';
$thankYouMessage = "succesful sent.";
if(! mail($siteEmail, $emailTitle, $message, 'From: ' . $_POST['nombre'] . ' <' . $_POST['email'] . '>'))
echo 'cannot send...';
}
Anyone can help me?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
你能尝试一下这个吗:
Could you try this out: