I want to close the current window with the click of a button, inside a JQuery UI dialog box.
I tried with window.close():
$(document).ready(function() {
  $("#sessionReason").dialog({
    autoOpen: false,
    modal: true,
    buttons: {
      "Submit": function() {
        window.close();
      },
      "Cancel": function() {
        $(this).dialog("close");
      }
    }
  });
  $("#cancelSessionButton").click(function() {
    $("#sessionReason").dialog("open");
  });
});<!DOCTYPE html>
<html>
<head>
  <title>jQuery UI Example</title>
  <script src="http://code.jquery.com/jquery-1.9.1.js"></script>
  <script src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script>
  <link href="http://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css" rel="stylesheet" />
</head>
<body>
  <input id="cancelSessionButton" type="button" value="Cancel Session" class="redButton" />
  <div id="sessionReason" title="Reason">
    <p>Please provide the reason for cancelling the session.</p>
    <div class="inputRow">
      <textarea id="sessionReasonBox" class="reasonBox"></textarea>
    </div>
  </div>
</body>
</html> 
     
    