我正在使用 $this->Js->submit 将值异步传递给我的控制器,而不是更新 div (id = #upcoming)。不知何故,我无法保存/检索传递给我的控制器的字段“测试”的值。Firebug 告诉我传递了正确的值。我究竟做错了什么?
查看文件(播放列表.ctp):
echo $this->Form->create('Add', array('url' => array('controller' => 'Gods', 'action' => 'add')));
echo $this->Form->input('test');
echo $this->Js->submit('Addddd', array(
'url' => array(
'controller' => 'Gods',
'action' => 'add'
),
'update' => '#upcoming'
));
echo $this->Form->end();
echo $this->Js->writeBuffer(array('inline' => 'true'));
控制器动作:
public function add()
{
$this->autoLayout = false;
$this->layout = 'ajax';
$link = $this->request->data['Add']['test'];
$this->set('test',$link);
}
及其视图文件(add.ctp):
<?php
echo $test;
?>
谢谢你的帮助!