getJSON return variable.. solution?
<p>My function fetches if the user is banned and i want to return a variable that determines if a popup displays; but as I've found out you can't return a variable from a <code>getJSON</code> function.</p>

<pre><code> function fetchban() {
    $.getJSON('/fetchban.php',function(data) {

        if(data==0) {

            var banned =  data;
        } else {
            $.each(data,function(index,result) {
            $('#ban-prompt').html(result);
            $('.popup-background').show();
            $('#ban-container-2').show();
            });
        }

    });

    return banned;
}

$('.button').click(function() {
var banned = fetchban();

if(banned==0) {

//display-popup

}

});
</code></pre>

<p>There are alot of lines i call the <code>fetchban</code> function, so i would prefer the <code>getJSON</code> in a function.  What is the solution?</p>
