我將一個值id傳遞給javascript函數。這裏的id正在打印。如何將id從javascript傳遞到codeigniter中的引導模型?
<script>
function openModal(id) {
document.getElementById('myModal').style.display = "block";
var img_id = id;
document.getElementById('caption').innerHTML = img_id;
}
</script>
現在我想將這個值傳遞給引導模式
<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>
是有可能。如果真讓我知道。
你能更具體嗎? – user218046
我想將img_id從javascript函數傳遞到引導模型,以便我將在模型中使用 –
您要在哪裏確定該id在模型中? – user218046