0
votes

I am a newbie in cakephp framework. Basically I am following this guide http://book.cakephp.org/2.0/en/core-libraries/helpers/js.html to get up and running with jQuery in cakephp

But when I try to load

<?php echo  $this->Html->script('jquery'); ?>

in default.ctp .. it is loaded in my view but in console I get an error

$ is not defined.

(The famous jQuery error :p)

But when I load it externally any jQuery file.. it seems to work fine. I want to make a plugin with no dependencies and use cakephp own jQuery

Am I doing something wrong ?

Please help

4
Check this question: stackoverflow.com/questions/10708599/…user796214
please see on firebug and make sure it is loading or it some conflictMoyed Ansari
Check for the jquery pathAnil kumar

4 Answers

1
votes

You must include js file into the webroot/js folder to use the corresponding js file.

0
votes

Try

echo  $this->Html->script('jquery');

Hope it will work!

0
votes

Try it:

$this->Html->script(array('jquery.js'));
$this->fetch('script');
0
votes

Do you have app/webroot/js/jquery.js in place?

echo  $this->Html->script('jquery');

is referring to the path.