Loading a page into a dialog with ui buttons

Loading a page into a dialog with ui buttons

Hi,

I am loading a page inside a dialog which has ui buttons. But it seems as that the javascript gets deleted and therefore the buttons are not displayed correctly.

This is a shortened example:
  1. $(function(){
        $('.edit_module').click(function(){
            DialogBox(); //creates the dialog
           
            var module_id = $(this).parents().find('.mod_id').val()
           
            $('#dialog')
                .load('test.php', { 'p_module_id': module_id } )
                .dialog('open');
           
            return false;
        });
       
    });    














And the test.php:

  1. <span id="btn_3" class="ui-button ui-corner-all ui-widget" title="test" >My Button</span>
                    <script type="text/javascript">
                        $("#btn_3").button({text:false, icons: {primary: "ui-icon ui-icon-pencil"}});
                    </script>



It simply deletes the script code. Any ideas? Or is that not possible? Thanks in advance.