Javascript CakePHP在确认对话框中返回[object]
有人知道为什么会这样吗 我的代码如下:Javascript CakePHP在确认对话框中返回[object],javascript,cakephp-2.3,Javascript,Cakephp 2.3,有人知道为什么会这样吗 我的代码如下: echo $this->Form->postLink('Excluir', array('action' => 'apagar', $credenciamento['Credenciamento']['id']), array('class' => 'linkbtn') ,array('confirm' => 'Deseja excluir este credenciamento?' )); cake生成的代码: <a
echo $this->Form->postLink('Excluir', array('action' => 'apagar', $credenciamento['Credenciamento']['id']), array('class' => 'linkbtn') ,array('confirm' => 'Deseja excluir este credenciamento?' ));
cake生成的代码:
<a href="#" class="linkbtn" onclick="if (confirm({"confirm":"Deseja excluir este credenciamento?"})) { document.post_52fdf00c73775579079346.submit(); } event.returnValue = false; return false;">Excluir</a>
当我试图通过此链接删除任何记录时,他可以工作,但对话框中返回的消息只是:
[对象]
确定按钮和取消按钮
我在这个项目中也使用了Jquery,但是脚本生成的对话框返回正确。我找到了答案:
echo $this->Form->postLink('Excluir credenciamento', array('action' => 'apagar', $credenciamento['Credenciamento']['id']), array('confirm' => 'Deseja excluir este credenciamento?','class' => 'linkbtn'));
数组中参数的顺序…您确定代码给出了该结果吗
onclick=“if(confirm)({“
应该抛出一个错误,因为JavaScript被第二个中断”
confirm()
需要一个普通字符串。通过google chrome复制为HTML…