Calling a method on a object
<p>I would like to log the result of calling a method on a object.</p>

<p>The current script log the result of the function in the property <code>token</code> literally I mean the result is the defined function.</p>

<p>What am I doing wrong here? Many thanks!</p>

<pre><code>   $(document).ready(function () {

        // General Settings
        var 
        ApiSettings = {
            clientId: 'aaa',
            clientSecret: 'bbb',
            token: function () {
                var token;
                $.getJSON(ApiSettings.uriGetToken, processData);
                function processData(data) {
                    token = data.access_token;
                }
                return token;
            }
        }
        ApiSettings.uriGetToken = 'https://ccc.com/oauth/token?grant_type=client_credentials&amp;client_id=' + encodeURIComponent(ApiSettings.clientId) + '&amp;client_secret=' + encodeURIComponent(ApiSettings.clientSecret);

        console.log(ApiSettings);
        console.log(ApiSettings.uriGetToken);
        var test = ApiSettings.token;

        console.log(test);



    });
</code></pre>
