title: How to handle the Close Button click event on my popup window using jquery
body: <p>I have this code in my Master page.</p>
  
  <pre><code>PopUpWindow = function (titles, message) {
        document.getElementById('window').innerHTML = message;
        $("#window").dialog({
            resizable: true,
            height: 140,
            title: titles,
            width: 500,
            message: "something here",
            modal: true,
            buttons: {
                "Close": function () {
                    $(this).dialog("close");
                }
            }
        });
    };
  
  
  &lt;div id="window" style="display: none;"&gt;
  
          &lt;/div&gt;   
  </code></pre>
  
  <p>I can able to display the popup mesage perfectly.. 
  My questions is.. </p>
  
  <p>I have this code in my controller.</p>
  
  <pre><code> return new JavaScriptResult() { Script = "alert('saved Successfully Added. Thank You.'); window.location='/ObnCategory/Index';" };
  </code></pre>
  
  <p>I changed the code to </p>
  
  <pre><code> return new JavaScriptResult() { Script = "PopUpWindow("saved","something here"); window.location='/ObnCategory/Index';" };
  </code></pre>
  
  <p>Here I am getting the popup perfectly but the problem is the popup closing automatically without clicing close button. due to window.location?</p>
  
  <p>can any body tell me how to load the page after close button click.. </p>
  
  <p>PopupWindow is generic I can not keep window.location on popupwindow script?</p>
  
  <p>thanks</p>