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
- <button class="clickme">Click Me</button>
- <div id="result"><div>
Php
- if ($_REQUEST["action"] == 'greetings'){
- echo' <div id="hello">Hello<div>';
- }
Jquery
- $(document).on('click', '.clickme', function(){
- $.ajax({
- url: 'php/function.php',
- type: 'post',
- data: {'action':'greetings' },
- success: function(result) {
- $("#result").append(result);
- $( "#hello" ).dialog({
- autoOpen: false,
- width: 1200,
- height: 500,
- modal: true
- });
- $("#hello").dialog( "open" );
- }
- });
- });
Thanks