小白兔晒黑了

导航

 

在html里添加一个触发弹出框的按钮

    $("#button1").on("click", function() {
        $("#dialogue").fadeIn();
        $("#dialogue_bg").fadeIn();
        $("#d_title").text("标题");
        $.ajax({
            url:    '/marketing/test',
            type:   'get',
            success: function(data) {
                $("#dialogue_content").html(data);
                $("#dialogue").css('width', "500px");
                $("#dialogue").css('top', ($(window).height() - $("#dialogue").height())/2);
                $("#dialogue").css('left', ($(window).width() - $("#dialogue").width())/2);
            }
        });
    });

 

在controller里添加test方法

public function test()
{
    $this->layout = false;
    $a1 = '测试';
    $a2 = '测试2';
    $this->set(compact("a1","a2"));
}

然后添加一个test.ctp文件

<div>
<?php echo $a1;?>
</br>
<?php echo $a2;?>
</div>

效果如下

posted on 2015-08-06 10:41  小白兔晒黑了  阅读(272)  评论(0编辑  收藏  举报