i have an html table in codeigniter which has different rows, when user clicks on any id of the table it should open a modal and display the details, id did the following:
in controller:
public function select(){
$id = $this->segments->uri(3);
$data['details'] = $this->user->selectdetails($id);
}
in model:
public function selectdetails($id) {
$this->db->select('*');
$this->db->where('id', $id);
$this->db->from('consignments');
$query = $this->db->get();
$result = $query->result();
return $result;
}
and finally in view:
$(".detailsbtn").click(function(e){
var modal = document.getElementById("details");
e.preventDefault();
var id = $(this).attr('id');
$.ajax({
type:'POST',
url:'<?php echo base_url()?>homecontroller/select/'+id,
success:function(data){
$('#details').find('.modal-content').html(data);
$('#details').modal('show');
}
});
});
<td>
<input id="<?= $val->id?>" class="detailsbtn btn-sm btn-info" type="button" value="<?= $val->awb?>">
</td>
<div class="modal-body">
<div class="container-fluid">
<div class="row">
<div class="col-md-12">
<?php foreach($details as $de){?>
<?php echo $de->consignee;?>
<?php }?>
</div>
</div>
</div>
however this is giving me error,page not found error, can anyone please tell me how to fix this, thanks in advance