This script is working correctly (alert) but in console is "undefined" (need in console 'yes' or 'no' like in alert).
Thanks for help.
Thanks for help.
Code:
var res;
if($(this).hasClass('login') == true){
login = $("#login").val();
$.ajax({
url: "testing.php",
type: "POST",
data: "login=" + login,
cache: false,
success: function(response){
if (response == "no"){
res = 'no';
alert(res);
}
else{
res = 'yes';
alert(res);
}
}
});
}
if(res == 'no'){
console.log(res);
}
else{
...