06.11 php saved
Crazy
Tags add more
 
Note
Added the including of the javascript
  1. //in your layout
  2. <?php echo $javascript->link('prototype'); ?>
  3. <?php echo $javascript->link('scriptaculous'); ?>
  4.  
  5.  
  6. //In your view
  7. <?php echo $ajax->div('shouts'); ?>
  8. <?php echo $ajax->divEnd('shouts'); ?>
  9.  
  10. <?php echo $ajax->form("/Shoutbox/add", "post", array('update' => "shouts", "model" => "Shoutbox", "complete" => "clear()")); ?>
  11. Name:<?php echo $form->input("Shoutbox.name", array("label" => "")); ?>
  12. Message: <?php echo $form->textarea("message")?>
  13. <?php echo $form->submit("Send"); ?>
  14. <?php echo $form->end(); ?>
  15.  
  16.  
  17. //in your controller(in my case shoutbox_controller.php)
  18. var $helpers = array('Html', 'Javascript', 'Ajax');
  19.  
  20. function add() {
  21.   $this->set("result", "wOOt, it works!");
  22.   $this->render("add", 'ajax');
  23. }
Parsed in 0.079 seconds, using GeSHi 1.0.7.14

Modify this Paste