Using a variable retrieved with $.post outside this $.post function
<p>I'm looking to load a set of data from a mysql database and use it in a calendar function written in jquery, but I'm having trouble using the retrieved data outside the $.post function.
Right now, I've hardcoded the data in the function and this works fine, looks (simplified, I off course need more than just alerting the data) like this:</p>

<pre><code>onRender: function(date) {      
    var redArray = ['2011815','2011820','2011824','2011825'];       
    alert(redArray);
}
</code></pre>

<p>Now I'd like to retrieve those numbers from my database with something like:</p>

<pre><code>onRender: function(date) {      
    $.post("../actions/calendar.php", {datetype: "1"}, function(data){
        if(data.length &gt;0) {
            redArray = data;
        }
    },"json");  
    alert(redArray);
}
</code></pre>

<p>But the alert gives nothing, or undefined. How can I use what I got from my php-file, outside of this $.post-thing? I need the variable later on, I cannot stay in the $.post function!</p>
