Can I open a div injected from a ajax request in a dialog?

Can I open a div injected from a ajax request in a dialog?

Hi guys,

Can I open a div injected from a ajax request in a dialog?

Example

Html
  1. <button class="clickme">Click Me</button>
  2. <div id="result"><div>
Php
  1. if ($_REQUEST["action"] == 'greetings'){
  2. echo' <div id="hello">Hello<div>'; 
  3. }
Jquery

  1. $(document).on('click', '.clickme', function(){
  2. $.ajax({
  3. url: 'php/function.php',
  4. type: 'post',
  5. data: {'action':'greetings' },
  6. success: function(result) {
  7.                               $("#result").append(result);
  8.                               $( "#hello" ).dialog({
  9.                                     autoOpen: false,
  10.                                     width: 1200,
  11.                                     height: 500,
  12.                                     modal: true
  13.                               });
  14.                               $("#hello").dialog( "open" );
  15.                         }
  16. });
  17. });


Thanks