Created
November 21, 2016 13:03
-
-
Save aranajhonny/5710792c5f3d8572a35e8e88c92572ec to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<input pattern="^([JVEG]{1})-([0-9]{8})-([0-9]{1})$" title="El formato debe ser J-12345678-9" placeholder="J-12345678-9" onkeyup="this.value=this.value.toUpperCase()"> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function crear_cliente(){ // funcion para la compra | |
//remove errors | |
$('.form-group').removeClass('has-error'); | |
//validating form modals | |
if ($("#rif").val() === "") { | |
$('[name="rif"]').parent().parent().addClass('has-error'); | |
}else{ | |
if ($("#razon_social").val() === "") { | |
$('[name="razon_social"]').parent().addClass('has-error'); | |
}else{ | |
if ($("#telefono").val() === "") { | |
$('[name="telefono"]').parent().addClass('has-error'); | |
}else{ | |
if ($("#email").val() === "") { | |
$('[name="email"]').parent().addClass('has-error'); | |
}else{ | |
if ($("#direccion").val() === "") { | |
$('[name="direccion"]').parent().addClass('has-error'); | |
}else{ | |
//post ajax form serialize | |
$.ajax({ | |
url : "?controller=clientes&action=crearforjson", | |
type: "POST", | |
data: $('#form').serialize(), | |
dataType: "json", | |
success: function(data) | |
{ | |
swal(data.msj); | |
$('#modal-id').modal('hide'); | |
$('.form-group').removeClass('has-error'); // clear error class | |
$('.help-block').empty() | |
}, | |
error: function(jqXHR, textStatus, error) | |
{ | |
swal(error); | |
$('#modal-id').modal('hide'); | |
$('.form-group').removeClass('has-error'); // clear error class | |
$('.help-block').empty(); // clear error string | |
} | |
}); | |
} | |
} | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment