Destroy a Dialog and Re-Create

Destroy a Dialog and Re-Create

Hi everybody,
I have a problem in making a new instance of a dialog that contains a div contained in a page.
The dialog does not open after destroy, I want another instance.......

HTML page:
  1. <div id="test">
  2.       <input type="text" id="name" name="name" /><br />
  3.       <input type="radio" id="foo1" name="name1" /><br />
  4.       <input type="radio" id="foo2" name="name1" /><br />
  5. </div>
  6. <br />
  7. <input type="button" id="openDialog" value="Open" />
JS page:
  1. $('#test').dialog({
  2.       autoOpen: false,
  3.       buttons: {
                "Exit": function() {
                      $(this).dialog('destroy')
                },
  4. });
  5. $('#openDialog').click(function() {
  6.       .... get mysql data via ajax and fill the dialog....
  7.       $('#test').dialog('open');
  8. });