Trying to figure out the reference on a dialog called with AJAX data.

Trying to figure out the reference on a dialog called with AJAX data.

Here's the code:
  1.  $.ajax({
  2.             type: 'GET',
  3.             url: url,
  4.             dataType: 'json',
  5.             success: function(data){

  6.                 $(data.html).dialog({
  7.                     autoOpen: false,
  8.                     title: 'Sign In',
  9.                     modal: true,
  10.                     dialogClass: 'login-form-dialog'
  11.                 });
  12.                 $(this).dialog('open');
  13.             },
  14.             error: function (xhr, ajaxOptions, thrownError){
  15.                 alert(xhr.statusText);
  16.                 alert(thrownError);
  17.             }  
  18.         });
Basically, on my page the user clicks a link, which pulls in the HTML for the form via JSON, which I then use to open the dialog.  If I create this dialog without autoOpen: false, it works just as intended - however I can't hide/destroy the dialog except by hitting the (x).  Calling

  1. $('.login-form-dialog').dialog('close');
Doesn't kill the dialog.  I've tried other permutations, like '.ui-dialog' and a plain-ol 'this', as you can see.

Since the dialog is being constructed with the ajax data - how do I refer to it from then on?