【发布时间】:2016-04-26 21:13:01
【问题描述】:
尝试将变量传递到 HTML 模式,运行查询并根据 id 显示信息...我可以将参数传递到 HTML 中,但我需要它在 SQL WHERE 语句的末尾一个查询...
我的脚本在这里。我想我需要一些 ajax 来完成这个。我创造了一个小提琴
http://jsfiddle.net/rbla/y7s5tf3p/
<script>
$(document).on("click", ".open-AddBookDialog", function () {
var myBookId = $(this).data('id');
//$(".modal-body #bookId").val( myBookId );
document.getElementById("bookId").innerHTML = myBookId;
});
</script>
变量被插入到 HTML 中,但我需要将 data-id 放入 php 变量而不是 HTML 中,以便我可以运行查询...
这是我的 PHP 文件
<?php
$id = ( this is where the data-id needs to be );
$sql = oci_parse($conn, select * from movies m where id=:id");
oci_bind_by_name($sql, ':id', $id);
oci_execute($sql, OCI_DEFAULT);
$objResult = oci_fetch_array($sql);
?>
【问题讨论】:
-
您使用的是引导程序 2 还是引导程序 3?
标签: jquery ajax modal-dialog bootstrap-modal simplemodal