调用控制器并通过onclick监听器传递值

<?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");


    });

I have this onlick listener from the value above on the user click the button it should go to the controller but I dont know how can I call controller and pass the value from id. this is in codeigniter framework hope somebody can help thanks

Hope this will help you :

$('.btn-info').click(function() {
  var id = $(this).find('.openid').val();
  if (id) 
  {
     window.location.href = "<?php echo base_url('ClientCont/List_Files/');?>" + id;
  }

});

Your controller's List_Files method should be like this :

public function List_Files($id)
{  
   /*echo passed id from the js here like this */

   echo $id;
}

Hope this will help you

  1. The html code is wrong. Closing anchor tag ("</a>") is missing. Fix the html as below

       '<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">**</a>**</td>'
    
  2. Try the below javascript code.

    $('.btn-info').click(function() {

      var id = $(this).find('input').val();
      var url = "<?php echo base_url();>ClientCont/List_Files?id="+id;
      window.location.replace(url);
    

    });