Cakephp-具有多个表单元素的Ajax数据

Cakephp-具有多个表单元素的Ajax数据,php,ajax,forms,cakephp,Php,Ajax,Forms,Cakephp,我有一个表单元素,它有一个onchange监听器,可以通过ajax触发另一个元素的更新 但是,我希望ajax post数据包括两个表单元素,而不仅仅是下面所示的($data) 我已经尝试将我想要序列化的两个元素放在它们自己的嵌套表单中,这会发布两个元素的值,但是因为这个新表单嵌套在主页表单中,所以cakephp在提交主页表单时会忽略这些元素 $data = $this->Js->get('#Reviewevent'.$index.'score')->serializeForm(

我有一个表单元素,它有一个onchange监听器,可以通过ajax触发另一个元素的更新

但是,我希望ajax post数据包括两个表单元素,而不仅仅是下面所示的($data)

我已经尝试将我想要序列化的两个元素放在它们自己的嵌套表单中,这会发布两个元素的值,但是因为这个新表单嵌套在主页表单中,所以cakephp在提交主页表单时会忽略这些元素

$data = $this->Js->get('#Reviewevent'.$index.'score')->serializeForm(array(
    'isForm' => true,
    'inline' => true
));

$this->Js->get('#Reviewevent'.$index.'score')->event('change', $this->Js->request(array(
    'controller'=>'events',
    'action'=>'getEventDescription'
    ), 
    array(
        'update'=>'#'.$index.'Description',
        'async' => true,
        'method' => 'post',
        'dataExpression'=> true , 
        'data'=> $data
    )
));

事实证明,可以使用jquery序列化div,而不需要将其作为表单。我只是将我想要发送到ajax请求中的两个元素放在一个div中,而不是一个嵌套的表单中,效果很好

 $data = $this->Js->get('#'.$index.'ThisDivHasTwoFormElementsInIt')->serializeForm(array(
    'isForm' => true,
    'inline' => true
));