Javascript/Jquery : Call a Function after Previous Function is Complete
<p>Ok, it's 1 a.m., I suck at coding javascript, and I can't seem to find a clear solution anywhere.</p>

<p>This is essentially what I have:</p>

<pre><code>$('a.button').click(function(){
    if (condition == 'true'){
        function1(someVariable);
        function2(someOtherVariable);
    }
    else {
        doThis(someVariable);
    }
});
</code></pre>

<p>How can I ensure that "function2" is called only after "function1" has completed?</p>
