title: Wait for modal window to close and then execute the following lines in javascript
body: <p>I have a modal Window which pops up and wait for 5 seconds and then closes.
  The code is as follows</p>
  
  <pre><code>  function callMe()
    {
  //alert("entering");
    $("#dialog").dialog({
           modal: true,
           //title: "Confirm",
           resizable: false,
           width: 300,
           height: 150,
           open: function (event, ui) 
           {
                 setTimeout(function () { $("#dialog").dialog("close");}, 5000);
  
           },
           buttons: {
               Ok: function () {
                  // $(this).dialog("close"); //closing on Ok
               },
               Cancel: function () {
                  // $(this).dialog("close"); //closing on Cancel
               }
           }
  
       });
           alert("Some Text");
    }
  </code></pre>
  
  <p>callMe() function is called on load of the HTML file. Here I want to show the alert message "Some Text" after the modal window closes in 5 second. But every time when I run this it shows both the modal window and alert box together. I want the modal window to display first , wait for 5 sec and then show the alert box.I tried using sleep but its still coming the same way. </p>