【发布时间】:2019-03-11 14:48:41
【问题描述】:
我需要将 jquery ID 值传递给我在 codeigniter 中的 est_model->get_img() 函数并在同一个模态框中显示所有内容,我尝试了我自己的逻辑它不起作用,请帮助大家,谢谢提前
下面是我的代码: 模态标签:
<a href="#view_all_img_modal" data-toggle="modal" data-est-id="<?php echo $row->est_id;?>">View all</a>
我的 jquery:
$('#view_all_images_modal').on('show.bs.modal', function(e) {
var est_id = $(e.relatedTarget).data('est-id');
$.ajax({url:"admin/est_view.php?ID="+est_id,cache:false,success:function(result){
$("#view_all_img_modal").html(result);
}});
});
模态框:
<div class="modal fade" id="view_all_img_modal" tabindex="-1" role="dialog">
<div class="row">
<?php
$id=$_GET['ID'];
$est_img=$this->est_model->get_img($id);
if($est_img):
foreach ($est_img as $img):
$ser_img=($img->img_name==NULL)?'no-image.png':$img->img_name;?>
<img src="<?php echo base_url('../public/images/rel_img/'.$ser_img);?>">
<?php endforeach;
endif;?>
</div>
</div>
【问题讨论】:
标签: javascript php jquery html codeigniter