Undefined variable: javascript in cakePHP with scriptaculous

Today i am trying to use ajax call in cakephp.

<?php  echo $ajax->submit('Submit', array('url'=> array('controller'=>'users', 'action'=>'add'), 'update' => 'testdiv')); ?>

I found this error:

Undefined variable: Javascript

After a couple of searching I found the following things can cause this problem:

1. You do not have the html, javascript and ajax helper defined in your own controller (eg. user_controller.php)

var $helpers = array('Html','Javascript','Ajax'); 

2. Your render action points to a view where no view file is existing for. ( so the view file HAS to be created!

$this->render('the_method','ajax'); 

Hope it helps somebody who is experiencing the same problem I had.

 

Related Posts

  • jquery UI tab in cake php
  • Remove the default interface CakePHP links in default Cake apps?
  • Cakephp: Creating and Sending Parameters Between Controller and View
  • Facebook like Expanding Textbox with Jquery.
  • How to bind an event in jquery after content load dynamically
the coder

Got something to say? Go for it!

*

 
More in CakePHP Tips (1 of 2 articles)