我将值id传递给javascript函数。其中id正在打印。
<script>
function openModal(id) {
document.getElementById('myModal').style.display = "block";
var img_id = id;
document.getElementById('caption').innerHTML = img_id;
}
</script>
现在我想将此值传递给bootstrap模式
<div id="myModal" class="modal">
<button type="button" id="close" onclick="closeModal()">close</button>
<div class="modal-content">
<div class="mySlides">
<?php
//here i want to use this id with if condition so that desired image is
//displayed.With for each all images are coming.
//$project_images = explode(",", $value['project_gallery']);
$project_images = json_decode($value['project_gallery'],true);
foreach ($project_images as $project_image_value) {
?>
<img src="<?= base_url() ?>assets/uploads/projects/<? =$project_image_value['fname']?>" style="width:100%">
<?php
}
?>
</div>
</div>
</div>
是否有可能。如此,请告诉我。
答案 0 :(得分:0)
在bootstrap模式中添加一个隐藏字段,如
EventBus.getDefault().postSticky(new SliderBusModel(SlideID,SlideImage,SlideType,SlideTitle));
并添加脚本
<input type="hidden" id="img_id" name="img_id">
}
因此,在模型中,您将获得一个字段img_id,其中包含您要传递的值