I have a function like this
function is_register(user_id){
    $.ajax({
        method: "POST",
        url: "functions.php",
        data: {user_id: user_id, action: "is_registred"}
    }).done(function(data) {
        return data;
    });
}
I want to execute this function somewhere else in my code, but it doesn't work :
is_register(user_infos.id, function(is_registred_status){   
    console.log(is_registred_status);
}
As you can see, I want the "is_register" function to be completly executed before continue, so I make a callback function to log the result. Where I'm wrong ?
 
     
     
     
    