Return to Snippet

Revision: 18562
at October 2, 2009 08:31 by Freebit


Updated Code
<script type="text/javascript"> 
    $(function() {
        // dialog prepare function
        $.prepare_dialog = function() {
            $(document).find('body').append('<div id="generic_dialog"></div>');
            $('#generic_dialog').dialog({
                autoOpen: false,
                bgiframe: true,
                resizable: true,
                height:400,
                width: 800,
                modal: true,
                buttons:    {
                    'Close': function(){
                        $(this).dialog('close');
                    }
                }
            });
        }
        // dialog content polling
        $.fetch_dialog_content = function() {
            $.ajax({     
                type: 'POST',
                url: '{{$base_url_lang}}' + 'system/test/acl_editor_test/get_dialog_content',
                success: function(html_input){
                    $('#generic_dialog').html(html_input);
                    $('#generic_dialog').dialog('open');
                }
            });
        }
        // "click" event registration
        $('#open_first_editor').click(function(){
            $.fetch_dialog_content();
        });    
        
        // dialog preparation
        $.prepare_dialog();
        
    });
</script>

<div id="main_content">
    <a id="open_first_editor">Open First Dialog</a>
</div>

Revision: 18561
at October 2, 2009 08:21 by Freebit


Updated Code
<script type="text/javascript"> 
    $(function() {
        // dialog prepare function
        $.prepare_dialog = function() {
            $(document).find('body').append('<div id="generic_dialog"></div>');
            $('#generic_dialog').dialog({
                autoOpen: false,
                bgiframe: true,
                resizable: true,
                height:400,
                width: 800,
                modal: true,
                buttons:    {
                    'Close': function(){
                        $(this).dialog('close');
                    }
                }
            });
        }
        // dialog content polling
        $.fetch_dialog_content = function() {
            $.ajax({     
                type: 'POST',
                url: '{{$base_url_lang}}' + 'system/test/acl_editor_test/get_dialog_content',
                success: function(html_input){
                    $('#generic_dialog').html(html_input);
                    $('#generic_dialog').dialog('open');
                    $('#loadingMsg').fadeOut(400);
                }
            });
        }
        // "click" event registration
        $('#open_first_editor').click(function(){
            $.fetch_dialog_content();
        });    
        
        // dialog preparation
        $.prepare_dialog();
        
    });
</script>

<div id="main_content">
    <a id="open_first_editor">Open First Dialog</a>
</div>

Revision: 18560
at October 2, 2009 08:20 by Freebit


Initial Code
{{include file="_header.tpl"}}  

<script type="text/javascript"> 
    $(function() {
        // dialog prepare function
        $.prepare_dialog = function() {
            $(document).find('body').append('<div id="generic_dialog"></div>');
            $('#generic_dialog').dialog({
                autoOpen: false,
                bgiframe: true,
                resizable: true,
                height:400,
                width: 800,
                modal: true,
                buttons:    {
                    'Close': function(){
                        $(this).dialog('close');
                    }
                }
            });
        }
        // dialog content polling
        $.fetch_dialog_content = function() {
            $.ajax({     
                type: 'POST',
                url: '{{$base_url_lang}}' + 'system/test/acl_editor_test/get_dialog_content',
                success: function(html_input){
                    $('#generic_dialog').html(html_input);
                    $('#generic_dialog').dialog('open');
                    $('#loadingMsg').fadeOut(400);
                }
            });
        }
        // "click" event registration
        $('#open_first_editor').click(function(){
            $.fetch_dialog_content();
        });    
        
        // dialog preparation
        $.prepare_dialog();
        
    });
</script>

<div id="main_content">
    <a id="open_first_editor">Open First Dialog</a>
</div>

{{include file="_footer.tpl"}}

Initial URL

                                

Initial Description

                                

Initial Title
JQuery generic dialog example part 1/2

Initial Tags
ajax, jquery

Initial Language
jQuery