如何在codeigniter中将id从javascript传递到引导模型?
我将一个值id传递给javascript函数如何在codeigniter中将id从javascript传递到引导模型?,javascript,php,jquery,twitter-bootstrap,codeigniter,Javascript,Php,Jquery,Twitter Bootstrap,Codeigniter,我将一个值id传递给javascript函数 <script> function openModal(id) { document.getElementById('myModal').style.display = "block"; var img_id = id; document.getElementById('caption').innerHTML = img_id; } </script> 函数OpenModel(id){ do
<script>
function openModal(id) {
document.getElementById('myModal').style.display = "block";
var img_id = id;
document.getElementById('caption').innerHTML = img_id;
}
</script>
函数OpenModel(id){
document.getElementById('myModal').style.display=“block”;
var img_id=id;
document.getElementById('caption')。innerHTML=img_id;
}
现在我想把这个值传递给引导模式
<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>
关闭
资产/上传/项目/“style=“width:100%”
是否可能。如果可能,请告诉我。在引导模式中添加一个隐藏字段,如
<input type="hidden" id="img_id" name="img_id">
}
因此,在模型中,您会得到一个字段img_id,其中包含您想要传递的值您能更具体一点吗?我想将img_id从javascript函数传递到引导模型,以便我将在模型中使用,您希望该id在模型中的确切位置?我想在以modal编写的php代码中使用该id如何使用php获取隐藏的输入值以使用您必须使用GET/POST将js变量发送到phpI。我不明白。您能详细说明一下吗
function openModal(id) {
$("#img_id").val(id);
document.getElementById('myModal').style.display = "block";
var img_id = id;
document.getElementById('caption').innerHTML = img_id;