JQuery 2.2.0错误

时间:2016-04-18 19:15:05

标签: jquery cakephp

我有一个由CakePHP 3生成的页面。这是基本结构:

<!DOCTYPE html>
<html>
    <head>
        <?= $this->Html->charset() ?>
        <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
        <title>
            Delta BEC |
            <?= $this->fetch('title') ?>
        </title>
        <?= $this->Html->meta('icon') ?>

        <?= $this->Html->css('bootstrap.min') ?>
        <?= $this->Html->css('font-awesome.min') ?>
        <?= $this->Html->css('custom') ?>

        <?= $this->fetch('meta') ?>
        <?= $this->fetch('css') ?>
        <?= $this->fetch('script') ?>
    </head>
    <body>
        <div class="wrapper">
            <?= $this->Flash->render() ?>
            <?= $this->fetch('content') ?>
        </div>

        <?php $this->Html->script('../plugins/jQuery/jQuery-2.2.0.min.js'); ?>
        <script src="https://code.jquery.com/ui/1.11.4/jquery-ui.min.js"></script>
        <script>
            $.widget.bridge('uibutton', $.ui.button);
        </script>
        <?php $this->Html->script('bootstrap.min.js'); ?>
        <?php $this->Html->script('app.min.js'); ?>
    </body>
</html>

看着它我没有看到任何错误,但我收到了这些错误:

jquery-ui.min.js:6 Uncaught ReferenceError: jQuery is not defined(anonymous function) @ jquery-ui.min.js:6(anonymous function) @ jquery-ui.min.js:6
login:69 Uncaught ReferenceError: $ is not defined

我错过了什么?

1 个答案:

答案 0 :(得分:1)

您没有输出脚本。

<?= $this->fetch('script') ?>
  ^-- Implied echo

<?php $this->Html->script('../plugins/jQuery/jQuery-2.2.0.min.js'); ?>
  ^-- No implied echo => not included in resposne