ajax 调用在 cakephp 中不起作用

ajax call not working in cakephp

我正在尝试通过 ajax 电话提交表格。

 echo $this->Form->create('Bid', array('url' => array(
        'controller' => 'bids',
        'action' => 'bidProject',
        $this->Session->read('employee.Id'),
        $pid[0] // project id
    ),
    )
);
echo $this->Form->input('day', array('id' => 'day', 'class' => 'form-control', 'label' => 'Days')) . "</br>";
echo $this->Js->submit(__('Submit', array('before' => $this->Js->get('#sending')->effect('fadeIn'),
        'success' => $this->Js->get('#sending')->effect('fadeOut')
    )), array('class' => 'btn btn-primary')
);
echo $this->Form->end();
}

这是我在 "BidsController"

中的出价项目
 public function bidProject($eid, $pid) {

    $bid = $this->Bid->findByProjectIdAndEmployeeId($pid, $eid);
    if (!$bid) {
        $this->request->data['Bid']['project_id'] = $pid;
        $this->request->data['Bid']['employee_id'] = $eid;

        $this->Bid->create();
        if ($this->Bid->save($this->request->data)) {
            if ($this->request->is('ajax')) {
             //Ajax call
            }
      //$this->Session->setFlash(__('The Bid has been saved'));
        }
    } else {
        $this->Session->setFlash(__('Bid have already done for given Employee Id'));
    }
}

当我点击提交按钮时,既没有出现错误,也没有请求响应,而且数据无法存储在数据库中。我在哪里遇到问题?如何解决这个问题?

在所有 $this-> script (); 之后或在提交按钮之后的任一布局中使用此代码。

$this->Js->writeBuffer(array('inline' => true,'cache' => true))