【发布时间】:2015-10-11 13:30:42
【问题描述】:
我正在尝试在 JQuery 脚本中创建 $this->Html->link。这个链接重定向到我的控制器中的一个动作,问题是我不能这样做。
我该怎么做?
试试这个。
$(document).ready(function() {
$('#dataTables-example').DataTable({
"processing": true,
"serverSide": true,
"ajax":{
url: "<?php echo $this->Html->url("/Empresas/indexAjax.json");?>",
dataSrc:""
},
"columns": [
{"data": "Empresa.id"},
{"data": "Empresa.nomeFantasia"},
{"data": "Empresa.cnpj"},
{"data": "Empresa.telefone1"},
{"data": "Empresa.telefone2"},
{"data": "Empresa.celular"},
{"data": "Empresa.aberto"},
{"data":null,
"bSortable": false,
"render": function(obj) {
return "<?php echo $this->Html->link('<i class="glyphicon glyphicon-eye-open"></i>',
array('action' => 'view', obj["Empresa"].id),
array('title'=>'view', 'escape' => false)); ?>";
//return '<a href=/Project/Empresas/view/' + o["Empresa"].id + '>' + 'View' + '</a>';
}
}
]
});
});
【问题讨论】:
标签: php jquery cakephp cakephp-2.0