[英]How I can use anchor tag href to open details data for my code?
我試圖在模型框中而不是新的html頁中打開從php-mysql獲取的詳細數據。 目前它正在其他HTML頁面中打開,但我想在模型框中添加它。
這是我當前的代碼:
<a class="btn btn-info" href="details.php?view_id=<?php echo $row['userID']; ?>" title="click for Details" onclick="details.php"><span class="glyphicon glyphicon-eye-open"></span> Show Details</a>
在這里它指的是details.php?view_id,但是找到了帶有ID選擇器(例如波紋管)的模型示例
<a href="#openModal">Show Details</a>
<div id="openModal" class="modalDialog">
<a href="#close" title="Close" class="close">X</a>
<div>
<a href="#close" title="Close" class="close">X</a>
<h2>Modal Box</h2>
</div>
</div>
如何添加href =“ details.php?view_id =”而不是#openModel ?
我是新手,請幫忙。
function edit_m_id(str){ var xhttp; document.getElementById("edit_con_tent").innerHTML = "<center>loading.......</center>"; xhttp = new XMLHttpRequest(); xhttp.onreadystatechange = function() { if (this.readyState == 4 && this.status == 200) { document.getElementById("edit_con_tent").innerHTML = this.responseText; } }; xhttp.open("GET", "edit_m_con.php?q="+str, true); xhttp.send(); }
<a href="#small-modal" onclick="edit_m_id('<?php echo $id_rand;?>')" data-toggle="modal">Edit</a> <div id="small-modal" class="modal fade" role="dialog"> <div class="modal-dialog"> <div class="modal-content"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal">×</button> <h4 class="modal-title">Modal Header</h4> </div> <div class="modal-body"> <span id='edit_con_tent'></span> <p>Some text in the modal.</p> </div> <div class="modal-footer"><button type="button" class="btn btn-default" data-dismiss="modal">Close</button> </div> </div> </div> </div>
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.