我在使用 Cake PHP 删除 javascript 确认对话框时遇到问题。
我正在使用此代码:
<td><?php echo $this->Html->link('Delete',
array('controller' => 'RealEstate', 'action' => 'delete',$r['RealEstate']['id']),
array('onclick'=>'return confirm(\"Are you sure?\");'))?> </td>
这会产生 html:
<td><a onclick='return confirm(\"Are you sure?\");' href="/cake1/RealEstate/delete/65">Delete</a> </td>
如您所见,这会产生错误的 Html。
如何解决这个问题?
已修复: 问题出在反斜杠“你确定吗?”,只需删除\,这效果很好“你确定吗?”
最佳答案
试试这个
<?php
echo $this->Html->link('',array('controller'=>'Mycont','action'=>'deletepic',$id),
array('confirm'=>'Are you sure you want to delete the image?'));
?>
关于javascript - CakePHP删除确认,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22519966/