Ajax Helper requirement

What are the files needed in order to use the AJAX helper and should it placed.

The manual (cookbook) says that it should be in /app/webroot/js but it doesn't say which files are needed. Scriptaculous files are may and the downloaded zip files are organized into subdirectories. Should all scriptaculous files be place in just one directory without subdirectory?

Asked by bombaler, on 11/3/10

1 Answer

It sounds like you are using CakePHP 1.2. I highly recommend going with 1.3, the JS Helper is VASTLY improved. You aren't stuck using a specific framework. I'm using jQuery on 1.3 RC1, its pretty sweet.

http://book.cakephp.org/view/1592/Js

To answer your question, I don't believe you need to place the files in any specific place, you just need to make sure they are included in the page. For instance I've got the jQuery library included from Google's CDN, then I've got a 'script.js', that I've put into my webroot/media/js.

The new JS Helper took me a bit to figure out, but now I've got it doing AJAX submits with no problem.

It's really kind of surreal to see a PHP Framework writing code for a Javascript framework....

Answered by emptywallson 11/3/10

Thanks for the response. I also found out that the scripts should be inside ./app/webroot/js. What was needed to be there is the prototype.js file. It should be in that directory and not in a sub-directory. What I did wrong was I simply unzip the sriptaculous tgz file in the ./app/webroot/ directory. Since the tgz file contains other files and sub-directories then cake can't find it within the folder.

Now that I know I also place all other .js file in /app/webroot/js.

Thanks a lot.

bombaler - on 12/3/10

<< comments | comments >>
<< previous next >>

Your Answer

You can use Creole Wiki Syntax to format your text.

Rating

0

Viewed

163 times

Last Activity

on 12/3/10