[jQuery] Synthax problem
[jQuery] Synthax problem
Hi everyone
I have a problem with the use of an ajax call in a function. I want to
get the result of the ajax call for processing to the return of the
function.
I've tried something like that
function checkUsername(s)
{
TO_RETURN = $.ajax({
type: "POST",
url: 'http://'+ CURRENT_DOMAIN + '/ajax/checkUsernameExists/
username/'+s,
async: false,
success: function(msg){
if(msg=='true'){
return true;
} else {
return false;
}
}
});
if(TO_RETURN) return true;
else return false;
}
But it didn't work ...
If anyone could help me :)
PS : I'm a novice in jQuery and i have low skills in javascripts