Passing variables between functions
<p>I have two functions, one that makes an Ajax request when the user loads the page, and one that will run every 5 or so seconds to update something. Using the first function, I can output a variable that I need to use in the second function. </p>

<pre><code>function insert_last_ten() {
    $.ajax({
       url: 'freeshout/chatlog.php',
       success: function(data) {
         $("#inner-wrap").html(data);
         var first_child = $("#inner-wrap :first-child").html();
         var value = first_child.match(/(value)=["']?((?:.(?!["']?\s+(?:\S+)=|[&gt;"']))+.)["']?/);
         var realtime = value[2];
       }
     });
    }
</code></pre>

<p>Basically, I need to use <code>realtime</code> to do something else in another function. For the sake of simplicity, let's pretend this is the second function:</p>

<pre><code>function update() {
    alert(realtime);
}
</code></pre>

<p>How could I go about making that work?</p>
