title: can't close dialog box within ajax success
body: <p>I'm calling a dialog box on the fly (on click), not setting it up as a var first. Like so:</p>
  
  <pre><code>$(".deleteSaved").click(function() {
          save_id = $(this).attr('id');
  
  
      div="&lt;div&gt;Are you sure you want to delete this?&lt;/div&gt;";
      $(div).dialog({ 
          buttons: { 
              "Delete": function() { 
                  $.ajax ({
                      url:"util.php",
                      data:"q=0&amp;f=delete&amp;save_id="+save_id,
                      success: function(result){
                          $(this).dialog("close"); //this line is not working
                          $("#toprow"+save_id).fadeOut();
                          $("#botrow"+save_id).fadeOut();
                      }
                  })
              },
              "Cancel": function() { 
  
                  $(this).dialog("close");
              } 
          },
          modal: true,
          title: 'Delete Saved Signal',
          resizable: false
      });
  });
  </code></pre>
  
  <p>But when I call <code>$(this).dialog("close");</code> within the ajax success function I get the following error: </p>
  
  <pre><code>Uncaught cannot call methods on dialog prior to initialization; attempted to call method 'close'
  </code></pre>
  
  <p>Within the "<code>cancel</code>" button <code>$(this).dialog("close");</code> works just fine.</p>
  
  <p>How can I get the close function to work within the ajax success call?</p>