script.aculo.us の src 以下にある js ファイルを app/webroot/js にコピーする
prototype.js を app/webroot/js にコピーする
index.ctp の 部に以下を追加
<?php echo $javascript->link('prototype'); ?>
<?php echo $javascript->link('scriptaculous'); ?>
index.ctp の 部に以下を追加
<h1>linkh1>
<div id="user">
div>
<?php echo $ajax->link('View User',
array('controller' => 'users', 'action' => 'view', 1),
array('update' => 'user', 'complete' => 'alert("Hello World")' )
);
?>
views/users/view.ctp を作成
<html> <head>
<meta name="Content-Type" content="text/html; charset=utf-8">
<title>title>
head>
<body>
<h1><?php echo $user['User']['username'] ?>h1>
<p>
<small>password: <?php echo $user['User']['password'] ?>small>
p>
<p>
<small>趣味: <?php echo $user['Profile']['hobby'] ?>small>
p>
body> html>
users_controll.php に以下を追加
var $helpers = array('Html', 'Javascript', 'Ajax');
function view($id = null)
{
$this->User->id = $id;
$this->set('user', $this->User->read());
}