maintain value of variable outside function in javascript?
<p>I try to manipulate a variable inside a function. But it seems to forget the values once I exit the function, eventhough the variable is declared outside the function.</p>

<p>The essential code:</p>

<pre><code>var posts = {};                

            // Perform a data request
            // skjutsgruppens-page
            $.oajax({
                url: "https://graph.facebook.com/197214710347172/feed?limit=500",
                    *SNIP*
                    success: function(data) {
                    $.extend(posts, data);
                }
            });


            // Gruppen
            $.oajax({
                url: "https://graph.facebook.com/2388163605/feed?limit=500",
                *snip*
                success: function(data) {
                    $.extend(posts, data);
                }
            });
</code></pre>

<p>The oajax retrievies data from facebook. I want to make a variable that contains the data from both oajax methods.</p>

<p>The actual code: <a href="http://eco.nolgren.se/demo/resihop/" rel="nofollow">http://eco.nolgren.se/demo/resihop/#</a></p>
