我有以下脚本:
.gitignore
答案 0 :(得分:0)
is.js' email和phone验证器可以解决。
$(function() {
$(".submit").click(function() {
var full_name = $("#full_name").val();
var cell_phone = $("#cell_phone").val();
var email = $("#email").val();
var dataString = 'full_name='+ full_name + '&cell_phone=' + cell_phone + '&email=' + email;
if (full_name=='' || is.not.eppPhone(cell_phone) || is.not.email(email))
{
$('.success').fadeOut(200).hide();
$('.error').fadeOut(200).show();
}
else
{
$.ajax({
type: "POST",
url: "join.php",
data: dataString,
success: function() {
$('.submit').fadeIn(200).hide();
$('.success').fadeIn(200).show();
$('.error').fadeOut(200).hide();
}
});
}
return false;
});
});
答案 1 :(得分:0)
var re = /^(([^<>()[\]\.,;:\s@\"]+(\.[^<>()[\]\.,;:\s@\"]+)*)|(\".+\"))@(([^<>()[\]\.,;:\s@\"]+\.)+[^<>()[\]\.,;:\s@\"]{2,})$/i;
var phoneno = /^\+?(?:[0-9] ?){6,14}[0-9]$/;
if (full_name=='' || !phoneno.test(cell_phone) || !re.test(email))