Codeigniter - Show Information in Modal Window

Codeigniter - Show Information in Modal Window

I answered myself this question.

<td data-title="Edit" align="center"><a href="<?php echo base_url("customer_edit/edit/$customer->cusId"); ?>"><button class="btn btn-primary btn-xs"><i class="fa fa-pencil"></i></button></a> <a data-toggle="modal" href="#<?php  echo $customer->cusId; ?>"><button class="btn btn-primary btn-xs"><i class="fa fa-eye"></i></button></a></td>

I edit a href like that href="#<?php echo $customer->cusId; ?>
Afterthat I just write this code on modal top:

<?php foreach ($customers as $get) { ?>
<div class="modal fade" id="<?php echo $get->cusId; ?>" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<?php } ?>

I edit id like that id="#<?php echo $get->cusId; ?>

It works better now!

view full data in modal by particular id in codeigniter using ajax

 $(document).ready(function(){  
$('.view_data').click(function(){
var id = $(this).attr("id");
console.log(id);
});
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>


<button class="btn btn-primary view_data" id="1" >VIEW FULL INFO</button>

How to show a popup modal in codeIgniter?

You are including jQuery more than once, you have actually included jQuery in your head section, remove those two before your custom javascript, that's why you are getting $(...).modal is not a function error:

<script src="http://code.jquery.com/jquery-latest.min.js" type="text/javascript"></script>
<script src="https://code.jquery.com/jquery-1.10.2.js"></script>


Related Topics



Leave a reply



Submit