title: How to close the JQuery Dialog Box from the child page
body: <p>I am using JQuery and C#.</p>
  
  <p>I am opening a JQuery Modal Dialog on the click of login link. Then I submit the complete form and form action is changed to my /login.aspx page, for a 15 seconds I am showing ajax processing image and on login.aspx page I validate the username and password entered by user. There can be two scenario</p>
  
  <p>1) User enters the valid username and password, in this case I am again redirecting back to same page from where the login link was clicked after validating on my /login.aspx page, this functionality is working fine as my current page is reloaded again.</p>
  
  <p>2) however when user enters wrong username and password, I keep user on /login.aspx page (Please note I don't redirect back to the page from where user has clicked the login link). Now Issue is that when user enter wrong username and password then /login.aspx comes, however if user in between clicks the browser back button then my Dialog box is shown open as I have set timeout for 15 secs. I want to close the dailog box once user enters the wrong username and password.</p>
  
  <p>Below is the Jquery code where I am opening the dialog box.</p>
  
  <pre><code> $('#skywardsLogin').dialog({
                          autoOpen: true,
                          width: 450,
                          modal: true,
                          title: $('.LoginpopupHeaderText').text()
                      });
  </code></pre>
  
  <p>And here I am trying to submit the form and changing the form action and also I am given timeout for 15 secs for showing the ajax processing image.</p>
  
  <pre><code>$("#aspnetForm").attr("action", "http://localhost:8080/english/include/aspx/Login.aspx");
  $("#aspnetForm").submit();
  $('#divSuccessLogin').show();
  // Wait for 15 seconds 
  setTimeout(closeDialog, 15000); 
  </code></pre>
  
  <p>CloseDailog code is given below.</p>
  
  <pre><code>        function closeDialog()
          {
              $('#skywardsLogin').dialog("close"); 
  }
  </code></pre>
  
  <p>I am struggling to close my dailog box as there is timeout for 15 secs to show the ajax processing image. please suggest</p>