【发布时间】:2012-03-29 21:30:24
【问题描述】:
我想创建 Cakephp 2.0 中最基本的 ajax 链接。
在 index.ctp 我有
<?php
echo $this->Js->link('myLink', array('controller'=>'technologies', 'action'=>'view'), array('update'=>'#success'));
?>
<div id="success"></div>
在 TechnologiesController.php 我有
public function view(){
$this->set('msg', 'message');
$this->render('view', 'ajax');
}
在 view.ctp 我有
<?php echo $msg;?>
它不是在成功 div 中设置视图,而是导航到 http://local.cake.com/technologies/view 页面以显示消息。
非常感谢任何帮助!
【问题讨论】:
-
听起来像是 javascript 错误......
标签: php cakephp cakephp-2.0 cakephp-helper