Hi,

I'm pretty new to jQuery. I'm having a problem with variable scope.
This function always returns false. The success variable is not being
changed within the getJSON function. I'd appreciate any help. Thanks.

var check_user = function()     {
        var success = false;
        url = baseurl + '/ajax/check_user_auth';
        $.getJSON(url, function(response)       {
                if(response.ok) {
                        alert(response.ok); // (evaluates to true)
                        success = true; // The parent "success" variable 
doesn't change.
This function always returns false.
                }
        });
        return success;
}

Reply via email to