Jquery Dialog: on the click of X second dialog will open with Yes and No Buttons
<p>On the close of dialog, I want another dialog to appear with Yes and No buttons. The yes button will close both dialogs and no button will close only second dialog. How should I do?</p>

<p>Code:</p>

<p>Html:</p>

<pre><code>&lt;button type="button" id="newContact" value="newContact"&gt;Add New Contact&lt;/button&gt;
&lt;div id="dialog-newContact" style="display: none;"&gt;&lt;/div&gt;
</code></pre>

<p>Jquery:</p>

<pre><code>$('#newContact').click(function () {

    $('#dialog-newContact').dialog({
        resizable: false,
        modal: true,
        width: 580,
        title: 'Add Contact',
        beforeClose: function (event, ui) {
            $('#dialog-close').dialog({
                resizable: false,
                modal: true,
                width: 300,
                tilte: 'Alert',
                buttons: {
                    'Yes': function () {
                        $('#dialog-close').dialog('close');
                        $('#dialog-newContact').dialog('close');
                        reloadPubs(event, ui);
                    },
                    'No': function () {
                        $('#dialog-close').dialog('close');
                    }
                }
            }); //inner dialog ends
            return false;
        }
    }); //dialog box ends
    disableSelectButton();
});
</code></pre>

<p>return false at the last does not close anything. whereas if i put return false as the first statement in beforeclose, 2nd dialog does not appear as it returns false at the start.</p>
