Created
September 24, 2015 19:27
-
-
Save fchevitarese/3c57ab65a766769818e4 to your computer and use it in GitHub Desktop.
new_ajax.js
This file contains hidden or 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
$.ajax({ | |
type:"GET", | |
data: {"id_cpf" : $('#id_cpf').val()}, | |
url:"/user/validate/", | |
success:function(data){ | |
switch (data) { | |
case "True": | |
$('#id_cpf').css( | |
{color: '#5BC24C', 'font-weight' : 'bold'} | |
); | |
$('#pessoa_pf').removeAttr('disabled', ''); | |
$('#pessoa_pf').addClass('pull-right'); | |
$('#cpf').removeClass('has-error'); | |
break; | |
case "False": | |
$('#cpf').addClass('has-error'); | |
$('#pessoa_pf').attr('disabled', ''); | |
break; | |
case "Existe": | |
$('#id_cpf').css( | |
{color: '#E63F24', 'font-weight' : 'bold'} | |
); | |
$('#cpf').addClass('has-error'); | |
$('#pessoa_pf').attr('disabled', ''); | |
$(function(){ | |
new PNotify({ | |
title: 'ATENÇÃO', | |
text: 'O CPF já esta cadastrado', | |
type: 'error' | |
}); | |
}); | |
} | |
} | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment