function validate_form()
{
var rv_name = /^[0-9]+$/;
var valName = document.poisk.name.value;
var lastName = document.poisk.lastname.value;
var fatherName = document.poisk.fathername.value;
var emailN = document.poisk.email.value;
var phoneN = document.poisk.phone.value;
valName = valName.replace(/\s+/g, '').trim();
lastName = lastName.replace(/\s+/g, '').trim();
fatherName = fatherName.replace(/\s+/g, '').trim();
phoneN = phoneN.replace(/[^0-9]/g, "");
if (valName == "" && lastName == "" && fatherName == "" && emailN == "" && phoneN == "") {
alert("Все поля пустые");
history.go(0);
}
if (valName.length == 1 || valName.length == 2 || rv_name.test(valName) == true || lastName.length == 1 || lastName.length ==2 || rv_name.test(lastName) == true || fatherName.length == 1 || fatherName.length == 2 || fatherName.length == 3 || fatherName.length == 4 || fatherName.length == 5 || rv_name.test(fatherName)==true || phoneN.length == 1 || phoneN.length == 2 || phoneN.length == 3 || phoneN.length == 4 || phoneN.length == 5 ) {
alert("Ошибка, попробуйте заново");
history.go(0);
}
else {
return false;
}
}
jQuery(document).ready(function() {
jQuery(".button").bind("click", function() {
var name = jQuery('.nameField').val();
var lastname = jQuery('.lastnameField').val();
var fathername = jQuery('.fathernameField').val();
var email = jQuery('.emailField').val();
var phone = jQuery('.phoneField').val();
name = name.replace(/\s+/g, '').trim();
lastname = lastname.replace(/\s+/g, '').trim();
fathername = fathername.replace(/\s+/g, '').trim();
phone = phone.replace(/[^0-9]/g, "");
jQuery('.nameField').val('');
jQuery('.lastnameField').val('');
jQuery('.fathernameField').val('');
jQuery('.emailField').val('');
jQuery('.phoneField').val('');
jQuery.ajax({
url: "/for_db.php",
type: "POST",
data: {name:name, lastname:lastname, fathername: fathername, email: email, phone: phone}, // Передаем данные для записи
dataType: "json",
success: function(result) {
if (result.message != "Слишком много результатов. Уточните параметры поиска."){
var res = '';
jQuery('.rows tr').remove();
jQuery('.rows').append(function(){
for(var i = 0; i < result.jm_users.name.length; i++){
res += '<tr><td>' + result.jm_users.id[i] + '</td><td>' + result.jm_users.name[i] + '</td><td>' + result.jm_users.lastname[i] + '</td><td>' + result.jm_users.fathername[i] + '</td><td>' + result.jm_users.email[i] + '</td><td>' + result.jm_users.phone[i] + '</td><td>' + result.jm_users.registerDate[i] + '</td></tr>';
}
return res;
});
}else{
var res = '';
jQuery('.rows tr').remove();
jQuery('.rows').append(function(){
res += '<tr><td>' + result.message + '</td></tr>';
return res;
});
}
return false;
}
});
return false;
});
});
Как сделать чтобы при выполнении if не выполнялась вторая функция?