Why the return value of my function always false
this is my function:
function checkUsername(username) {
var ret=false;
$.ajax({
type: "POST",
url: "user_validate.php",
async: true,
data: "username="+username,
success: function(data){
if(data == 0){
ret = true;
}else{
ret = false;
}
},
error:function() {
alert("ERROR");
}
});
return ret;
}
Is var ret doesn’t set the value?
Anything wrong with it..?
thanks before..!
The “A” in AJAX stands for “asynchronous”