简体   繁体   中英

How do I get JQuery to work with CakePHP?

I use CakePHP 2.0

I am following this guide http://nuts-and-bolts-of-cakephp.com/2009/01/19/jquery-in-the-cakephp-world-part-1/

I have included in my add.ctp viewer

$this->Javascript->link('https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js', false);

and I have

var $helpers = array(‘Javascript’, ‘Html’, ‘Form’);

in my controller...

The error I am getting is

Missing Helper
Error: JavascriptHelper could not be found.

Error: Create the class JavascriptHelper below in file: app/View/Helper/JavascriptHelper.php

According to the documentation, if you're using CakePHP 2.0 then jQuery comes already packaged with the framework.

See here for more detail on how to use jQuery and the JSHelper in CakePHP 2.0

The tutorial you've linked to is for version 1.3, so that's why it doesn't work....

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM