title: jQuery UI close dynamic dialog...or just the open dialog
body: <p>I am trying to close an open dialog at the end of a function call and also use my current button element to close the dialog. Here is the code that opens the dialog.  It is being called dynamically using the 'rel' attribute of the '.modal_btn'.  It opens just as expected:</p>
  
  <pre><code>    modalDialog = function(dialogId){
          $(dialogId).dialog({
              modal: true,
              draggable: false,
              resizable: false,
              width: 'auto',
              open: function() { $(".ui-dialog-titlebar-close").hide(); }
          });
      }
  
      $('.modal_btn').live('click', function(){
          var dialogId = $(this).attr('rel');
          modalDialog(dialogId);
      });
  </code></pre>
  
  <p>Now after the dialog is open I would like to use my current HTML elements for buttons: a Cancel and Save button.  The save button executes the ajax call and after the ajax call is complete I would like to close the dialog.  Also, I would like to be able to close the open dialog just by clicking the Cancel button.  I just can't seem to grasp this simple functionality...any ideas?</p>