我有一个带有简单 jQuery 验证的联系表单,并使用 Php 发送表单内容。我正在尝试包括电话字段验证。JavaScript 在验证电话字段和自动格式化/更正/完成电话字段时工作正常。但是 PHP 脚本不起作用。如果我删除 phoneNumber 字段,它工作正常。
(function($) {
"use strict";
/* Alert Boxes
* ------------------------------------------------------ */
var clAlertBoxes = function() {
$('.alert-box').on('click', '.alert-box__close', function() {
$(this).parent().fadeOut(500);
});
};
/* Contact Form
* ------------------------------------------------------ */
var clContactForm = function() {
/* local validation */
$('#contactForm').validate({
/* submit via ajax */
submitHandler: function(form) {
var sLoader = $('.submit-loader');
$.ajax({
type: "POST",
url: "inc/sendEmail.php",
data: $(form).serialize(),
beforeSend: function() {
sLoader.slideDown("slow");
},
success: function(msg) {
// Message was sent
if (msg == 'OK') {
sLoader.slideUp("slow");
$('.message-warning').fadeOut();
$('#contactForm').fadeOut();
$('.message-success').fadeIn();
}
// There was an error
else {
sLoader.slideUp("slow");
$('.message-warning').html(msg);
$('.message-warning').slideDown("slow");
}
},
jeck猫
犯罪嫌疑人X
FFIVE