function validarFormularioContacto() { if (validar_vacio('#nombre') && validar_correo('#email') && validar_vacio('#consulta') && validar_checkbox("#chk-privacidad")) { enviar_formulario_contacto(); } } function enviar_formulario_contacto() { $(".validation-msj").hide(); $("footer .contacto .form-group button").html("Enviando, por favor espere...").prop('disabled', true); $.ajax({ dataType: "json", type: "POST", url: "ControlIntranetJSON", data: { tabla: 5, estado: 1, per_contacto: $("#nombre").val(), empresa: $("#empresa").val(), email: $("#email").val(), telefono: $("#telefono").val(), consulta: $("#consulta").val(), cod_formulario: $("#cod-formulario").val() }, success: function(response) { if (response == 0) { $("footer .contacto .form-group, .texto-asterisco-obligatorio").remove(); $("#formulario-enviado").show(); } else { $(".validation-msj:not(#contacto-" + response + ")").hide(); $("#contacto-" + response).show(); } if (response == -2) { $("#cod-formulario").focus(); } }, complete: function() { }, error: function(response) { console.log("error"); return false; } }); }