returning a variable from the callback of a function
<p>I am using the following functions:</p>

<pre><code>function loop_perms(permissions) {
.... call check_perm here....
}
function check_perm(perm) {
        var result;
        FB.api(
         {
            method: 'users.hasAppPermission',
            ext_perm: perm
         }, function(response) {
            result = response;
         });
         return result;
    }
</code></pre>

<p>Now, the issue is that I am getting an <code>undefined</code> from the result of <code>check_perm</code> whereas in the Firebug console, I can see that <code>response</code> has a value of 0 or 1 (depending on perm)</p>

<p>Anyone knows what I am doing wrong? I am guessing it has something to do with the fact that i am trying to capture the value of a variable inside a callback.</p>

<p>Regards
Nikhil Gupta.</p>
