使用Jquery Popup加载Codeigniter视图

时间:2015-02-04 04:08:27

标签: php jquery codeigniter

我想用Jquery Pop up加载我的视图。我用Jquery的普通浏览器弹出窗口做到了。

$("#btn_preview").click(function(e){
        var message=$('#txtMessageRequired').val();
        $.ajax({
            type: "POST",
            data: {message: message},
            url: base_url+'index.php/newsletter/preview_newsletter',//Important: base_url is defined in the header section
            success:function(result){
                var w = window.open('about:blank', 'Newsletter Preview');
                w.document.write(result);
                w.document.close();

            }
        });
    });

但是Jquery弹出来试了很多。

有没有解决方案..提前致谢..

1 个答案:

答案 0 :(得分:0)

在这里,我可以解决我的问题..

$("#btn_preview").click(function(){
        var name=$('#txtName').val();
        var message=$('#txtMessageRequired').val();
        var tag = $("<div></div>");
        $(tag).attr("title", "Preview - Newsletter");
        $.ajax({
            type: "POST",
            data: {message: message, name: name},
            url: base_url+'index.php/newsletter/preview_newsletter',//Important: base_url is defined in the header section
            success:function(result){
                $(tag).dialog({
                    autoOpen: false,
                    show: {
                        effect: "blind",
                        duration: 1000
                    },
                    hide: {
                        effect: "explode",
                        duration: 1000
                    }
                });
                $(tag).dialog( "option", "width", 670 );
                $(tag).html(result).dialog().dialog('open');
            }
        });
    });