Skip to content

Instantly share code, notes, and snippets.

@cergey-obr
Last active February 19, 2016 05:35
Show Gist options
  • Save cergey-obr/89862bf0d47e1e6b54d6 to your computer and use it in GitHub Desktop.
Save cergey-obr/89862bf0d47e1e6b54d6 to your computer and use it in GitHub Desktop.
Проверка капчи через ajax
$.validator.addMethod('isCorrectCaptcha', function(value, element, params){
var is_valid = false;
$.ajax({
url: '/udata/custom/isCorrectCaptcha/',
type: 'POST',
async: false,
data: {
captcha: value
},
success: function(xml){
is_valid = $(xml).find('udata').text() == 'correct' ? true : false;
}
});
return is_valid;
}, 'Введите корректный код с картинки')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment