I have the following function
function checkIfUserExist(userName){
    $.ajax({
        type : "POST",
        url : "/test/checkUserName/",
        data : "userName=" + userName,
        success : function(data) {
            return data;
        }
    });
}
I am trying to call it from another function
$('#userName').blur(function() {
    alert ( checkIfUserExist($('#userName').val()) );
}
every time i am getting undefined in the alert box. but it should show me the return value in the alert box. 
how to fix this??
 
     
     
     
    