function calling from another function javascript
<p>I have 2 functions. <code>First</code> contains Jquery-UI dialog and called from the <code>Second</code> function. Something like :</p>

<pre><code>function First() {
    $('div').dialog({
        buttons: {
            "Ok": function () { /* code */
            }
        }
    });
}

function Second() {
    First();
    /* rest of this function code is depend upon the "Ok button" 
       function code */
}
</code></pre>

<p>Now my problem is that after calling function <code>First</code> the execution of script doesn't wait for <code>dialog's Ok button press</code>. Whats should i do, so that only after pressing the <code>Ok button</code>, the control return from the function <code>First</code>?</p>
