Код: Выделить всё
$.fn.doesEmailExist = function() {
let email = $(this).val();
var exists = false;
$.ajax({
type: 'POST',
url: base_url + "user/doesEmailExistAjax",
dataType: 'json',
data: { 'email': email },
success : function(response) {
}, error : function(jqXHR, exception) {
var message = 'Uncaught Error.\n' + jqXHR.responseText + ' - ' + exception;
console.log(message);
}
});
}
Вызывается с помощью:
if (element.doesEmailExist() == true ) {
Подробнее здесь: https://stackoverflow.com/questions/790 ... ery-plugin
Мобильная версия