title: creating confirm dialog in jquery
body: <pre><code>$("#first").dialog({ width: 304, modal: true,
  
    beforeclose: function (e, ui) 
    {
          $("#confirm").dialog({ width: 500, modal: true,
              buttons: {
                  "Confirm": function () {
                      document.location.href = "/Home/Index";
                  },
                  "Cancel": function () {
                      $(this).dialog('close');
                      return false;
                  }
              }
          });
      }
  });
  </code></pre>
  
  <p>The dialog <code>#first</code> closes without waiting for the <code>#confirm</code> dialog to open. I know about <code>confirm()</code> function of javascript but i want to use dialog in this case . How can i do that?</p>