-1
您好,我想通過使用基於模態窗口的MySQL數據庫來顯示動態數據,請給我一些演示。我想顯示在表的動態數據,併爲我的任何記錄的按鈕,單擊它必須顯示在模態窗口以及如何在動態數據庫中加載動態數據庫php
您好,我想通過使用基於模態窗口的MySQL數據庫來顯示動態數據,請給我一些演示。我想顯示在表的動態數據,併爲我的任何記錄的按鈕,單擊它必須顯示在模態窗口以及如何在動態數據庫中加載動態數據庫php
這是動態的數據是什麼,我都試過
<script>
function showHint(str) {
if (str.length == 0) {
document.getElementById("mymodalbody").innerHTML = "";
return;
} else {
var xmlhttp = new XMLHttpRequest();
xmlhttp.onreadystatechange = function() {
if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
document.getElementById("mymodalbody").innerHTML = xmlhttp.responseText;
}
};
xmlhttp.open("GET", "show.php?q=" + str, true);
xmlhttp.send();
}
}
</script>
<script>
function getPage(id) {
\t $('#output').html('<img src="LoaderIcon.gif" />');
\t jQuery.ajax({
\t \t url: "get_page.php",
\t \t data:'id='+id,
\t \t type: "POST",
\t \t success:function(data){$('#output').html(data);}
\t });
}
</script>
<div class="modal fade" id="myModal" tabindex="-1" role="dialog"
aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content" >
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h3 class="modal-title" style="text-align:center;">Information</h3>
</div>
<div class="modal-body" id="mymodalbody">
\t \t
\t \t <?php ?>
\t \t </div>
<div class="modal-footer">
<button type="button" class="btn btn-default " data-dismiss="modal">Close</button>
</div>
\t \t \t \t
</div><!-- /.modal-content -->
</div><!-- /.modal-dialog -->
</div><!-- /.modal -->
<div class="container" >
\t <div class="row">
\t <div class="col-lg-12 ">
<table class="table table-bordered " style="text-align:center;">
<thead >
<tr style="background-color:#FFF;" >
<th style="text-align:center;">Sr.</th>
<th style="text-align:center;">Name</th>
<th style="text-align:center;">Email</th>
<th style="text-align:center;">Mobile No</th>
<th style="text-align:center;">View</th>
</tr>
</thead>
<tbody>
\t \t <?php
\t \t \t $i=1;
\t \t \t $sql=mysql_query("select * from staff order by id asc") or die(mysql_error());
\t \t \t while($row=mysql_fetch_array($sql))
\t \t \t {
\t \t ?>
<tr>
<td><?php echo $i; ?></td>
<td><?php echo $row['name'];?></td>
<td><?php echo $row['email'];?></td>
<td><?php echo $row['mobile'];?></td>
<td><a data-toggle="modal" data-target="#myModal" value="<?php echo $row['id']; ?>" onclick="showHint(this.value)" ><i class="fa fa-eye"></i></a>
</td>
</tr>
\t \t <?php
\t \t \t \t $i++;
\t \t \t }
\t \t ?>
\t \t </tbody>
</table>
<!--end green board -->
</div>
</div>
<ul class="pagination" >
<li><a href="#">1</a></li>
<li class="active"><a href="#">2</a></li>
<li><a href="#">3</a></li>
<li><a href="#">4</a></li>
<li><a href="#">5</a></li>
</ul>`
</div>