I have this code for make some request to my server:
function myAjaxCheck(token) {
        $.ajax({
            type: 'POST',
            url: 'auth.php',
            data: {
                token: token,
            },
            dataType: 'json',
            success: function (data) {
                if (data.auth == 'OK') {
                    alert ('ok');
                    }
                } else {
                    alert('Error: ' + data.auth);
                }
            }
        }).done(function (data) {
            return data;
        });
    }
So, i need to pass the returned data into a variable like:
Var MyVariable = myAjaxCheck(token);
console.log(MyVariable);
at console:
undefined
Where is the problem, is supposed to data will returned when done, but isn't.
 
     
     
     
     
    