使用postLink删除记录时出现以下错误:
这看起来像是一个Javascript错误,但我自己并没有添加Javascript代码。
这是我的postLink(我使用两个参数):
$this->Form->postLink(__('Delete'), ['action' => 'delete', $p->id, $c], ['confirm' => __('Are you sure you want to delete # {0}?', $p->id)])
这是我的删除方法:
public function delete($id = null, $c = null) {
$this->request->allowMethod(['post', 'delete']);
// some code
return $this->redirect(['action' => 'index', $c]);
}
可能是什么问题?
更新
<a onclick="if (confirm("Are you sure you want to delete #
1836?")) { document.post_573da0811d667564814578.submit(); }
event.returnValue = false; return false;" href="#">Delete</a>