I try to get an ajax-result via function into a variable. But var output is always undefined. What am I doing wrong? I guess the problem is, that the ajax request takes some time, while the output is done immediately
var data = { 'something': 'anything' };
var output = ajaxed(data);
console.log(output);
function ajaxed(data) {
    $.ajax({
        url: "/script.php",
        type: "POST",
        data: data,
        dataType: "json"
    })
    .done(function( json ) {
        return json.response;
    });
}
 
    