0
我想使用Jquery對話框在一個頁面上顯示註釋,該頁面有多個從數據庫調用的行 - 每行都有一個鏈接,顯示一個應顯示相關內容的對話框爲那一行。在循環中將值傳遞給Jquery對話框
對話框工作正常,但我不能讓它從鏈接中獲取一個值,因此我可以在對話框顯示的div中查詢數據庫。
當有人點擊圖片時,我希望它顯示該行的註釋 - 這是我目前使用的代碼。我知道我沒有發送一個值,因爲我不知道該怎麼做 - 我怎樣才能得到這個將行ID附加到每行圖像上,然後在對話框打開時使它在對話框中可用,以便顯示該註釋?
<script>
$(function() {
$("#jui-dialog").dialog({
autoOpen: false,
title: "Note",
modal: true,
width: "640",
buttons: [{
text: "Close note",
click: function() {
$(this).dialog("close");
}}]
});
$("#jui-dialog-mdl-btn").bind("click", function(event) {
$("#jui-dialog").dialog("option", {modal: true}).dialog("open");
event.preventDefault();
});
});
</script>
<while begins>
<img src="/icons/16/note.png" title="View employee note" alt="View employee note" id="jui-dialog-mdl-btn">
<input type="hidden" value="<?=$id?>">
<while ends>
<div id="jui-dialog">
<div class="dialog-inner">
<?php
$query=mysql_query("SELECT content from notes WHERE id='$id'");
$count=mysql_num_rows($query);
$row=mysql_fetch_array($query);
$note=$row['content'];
print $note;
?>
</div>
</div>