简单的jQuery在cakephp中不起作用

时间:2012-10-30 14:53:36

标签: jquery html cakephp

我的简单jQuery对话框无法使用cakephp。

我的默认ctp是:

<head>
<?php echo $this->Html->charset(); ?>
<title>
    <?php echo $cakeDescription ?>:
    <?php echo $title_for_layout; ?>
</title>

<?php
    echo $this->Html->meta('icon');

    echo $this->Html->css('cake.generic');

    echo $this->Html->script('http://code.jquery.com/jquery-1.8.2.js');
    echo $this->Html->script('test');
    echo $this->fetch('meta');
    echo $this->fetch('css');
    echo $this->fetch('script');
?></head>

输出这个:

<script type="text/javascript" src="http://code.jquery.com/jquery-1.8.2.js"></script><script type="text/javascript" src="/cake/js/test.js"></script>

test.js已在'js'文件夹中:

$(function() {
    $( "#dialog" ).dialog();
});

和paginateste.ctp

<div id="dialog" title="Basic dialog">
<p>This is the default dialog which is useful for displaying information. The dialog window can be moved, resized and closed with the 'x' icon.</p></div>

有人能帮助我吗?感谢...

1 个答案:

答案 0 :(得分:1)

请务必加入适用的jquery-ui.jsjquery-ui.css

工作小提琴here