jQuery UI Widgets › Forums › General Discussions › Plugins › Validator, Drag & Drop, Sortable › Validation with $.post
Tagged: angular validation. angular widgets, Angular validator, jquery validation, jqwidgets validation
This topic contains 2 replies, has 2 voices, and was last updated by gusanomaly 11 years ago.
Hello, I’m validating if exist an email adress with this code:
{ input: '#email', message: 'El Email ya se encuentra registrado!', action: 'keyup', rule: function (input, commit) { $.post('<?php echo base_url(); ?>Usuario/checkEmail', { email: input.val() }, function(data) { if (data.resultado == 0) { return true; } return false; }, 'json'); } },
The probem is the data.resultado is 1 (false) but the alert message not appear, something is wrong? Thank you, Gustav.
Hi Gustav,
Your AJAX call will end after the validation function is called. In addition, your return true and return false are for your $.post function, not for the validation function. To learn how to do validation with AJAX, look at: http://www.jqwidgets.com/jquery-widgets-demo/demos/php/registration_form.htm?arctic
return true
return false
Best Regards, Peter Stoev
jQWidgets Team http://www.jqwidgets.com/
Thank you, Peter!
Best regards, Gustav.
You must be logged in to reply to this topic.