Javascript 调用控制器并通过onlick侦听器传递值
希望这对您有所帮助Javascript 调用控制器并通过onlick侦听器传递值,javascript,php,codeigniter,Javascript,Php,Codeigniter,希望这对您有所帮助 html代码是错误的。缺少结束锚标记(“”)。如下所示修复html <?php foreach($fetch_file as $row) { echo '<tr>'; echo '<td>' . base64_decode($row->file_perm_desc) . '</td>'; echo '<td style = "text-align:ce
”)。如下所示修复html
<?php
foreach($fetch_file as $row)
{
echo '<tr>';
echo '<td>' . base64_decode($row->file_perm_desc) . '</td>';
echo '<td style = "text-align:center;">' . date_format((date_create($row->date_entry)),"M d, Y") . '</td>';
echo '<td class = "text-center"><a class="btn btn-info" >
<input type = "hidden" name = "editid" class = "openid" value = ' . $row->file_perm_id . '>
<i class="glyphicon glyphicon-folder-open"></td>';
echo '<td class = "text-center"><a class="btn btn-warning" >
<input type = "hidden" name = "editid" class = "unpublishid" value = ' . $row->file_perm_id . '>
<i class="glyphicon glyphicon-comment"></td>';
echo '<td class = "text-center"><a class="btn btn-danger" >
<input type = "hidden" name = "editid" class = "deleteid" value = ' . $row->file_perm_id . '>
<i class="glyphicon glyphicon-trash"></td>';
echo '<td class = "text-center"><a class="btn btn-success" >
<input type = "hidden" name = "editid" class = "downloadid" value = ' . $row->file_perm_id . '>
<i class="glyphicon glyphicon-download"></td>';
echo '</tr>';
}
?>
$('.btn-info').click(function()
{
var id = $(this).find('.openid').val();
window.location.replace("<?php echo base_url();?>ClientCont/List_Files");
});
“**”
var id=$(this.find('input').val();
var url=“希望这对您有所帮助:
var id = $(this).find('input').val();
var url = "<?php echo base_url();>ClientCont/List_Files?id="+id;
window.location.replace(url);
.find(“.publishid”)
我没有看到任何与类匹配的元素,但我确实看到了未发布的元素,而且您似乎从未关闭过锚定标签….
请始终对答案做出回应,给出一些评论,或者,如果有帮助,将其标记为绿色并向上投票,这是感谢所有程序员的最佳方式
var id = $(this).find('input').val();
var url = "<?php echo base_url();>ClientCont/List_Files?id="+id;
window.location.replace(url);
$('.btn-info').click(function() {
var id = $(this).find('.openid').val();
if (id)
{
window.location.href = "<?php echo base_url('ClientCont/List_Files/');?>" + id;
}
});
public function List_Files($id)
{
/*echo passed id from the js here like this */
echo $id;
}