Moving data outside of the scope my jQuery AJAX call
<p>I have a little AJAX function that asks the server whether a particular checkbox should be checked. I'd like to pass the information to a variable outside of the scope of the AJAX function. Something along the lines of:</p>

<pre><code>isChecked = $.ajax({
                type: "POST",
                url: "/ajax/subscribe-query/",
                data: "selfKey=" + commentData['selfKeyValue'],
                success: function(isSubscribed){
                    if(isSubscribed == 'true'){
                        return = true;
                    }
                    else{
                        return = false;
                    }
                }
            })
</code></pre>

<p>or</p>

<pre><code>var isChecked; 
$.ajax({
                type: "POST",
                url: "/ajax/subscribe-query/",
                data: "selfKey=" + commentData['selfKeyValue'],
                success: function(isSubscribed){
                    if(isSubscribed == 'true'){
                        isChecked = true;
                    }
                    else{
                        isChecked = false;
                    }
                }
            })
</code></pre>

<p>Neither of those works of course. How do I do this?</p>
