function that has an ajax events return undefined when called : <p>I have a function called 'getAuthor' and inside there's an ajax events running (refer below)</p>

<pre><code>function getAuthor(id){
    $.get('http://www.connectnigeria.com/articles/wp-json/wp/v2/users/74',function(e){
        var author = e.name;
        console.log(author);
        return author;
    });
}
</code></pre>

<p>try to run from the console, you'll see it returns "undefined" while console.log display the expected response from the ajax call.</p>

<p>Any, ideas help please?</p>
