私はphpを使用してテーブルを作成していますが、これがテーブル本体の作成方法です。
while (mysqli_stmt_fetch($stmt)) {
// Create Table Body
$html .= "<tr>\n";
$html .= " <td>$title</td>\n";
$html .= " <td>$date</td>";
$html .= " <td align='center'>\n";
$html .= " <a href='#'>\n";
$html .= " <span class='view' title='View This Comment'></span>\n";
$html .= " </a>\n";
$html .= " </td>\n";
$html .= " <td class='td_catchall' align='center'>\n";
$html .= " <a href='#'>\n";
$html .= " <span class='edit' title='Edit This Comment'></span>\n";
$html .= " </a>\n";
$html .= " </td>\n";
$html .= " <td align='center'>\n";
$html .= " <a href='#'>\n";
$html .= " <span class='delete' title='Delete This Comment'></span>\n";
$html .= " </a>\n";
$html .= " </td>\n";
$html .= "</tr>\n";
}
このテーブルを使用すると、各コメントを表示、編集、および削除するための 3 つの列があります。アクションごとにjqueryダイアログをトリガーしたい。ビューダイアログで動作するようにしようとしました。ただし、リンクごとに 1 つのコメントのみが表示されます。このようなwhileループでダイアログを表示するコードを追加しました-
//Create View Blog Dialog Box
$viewBlog = "<div id='dialog-view'>\n";
$viewBlog .= " <h2>$title</h2>\n";
$viewBlog .= " <p>$date</p>\n";
$viewBlog .= " <p>";
$viewBlog .= " <img src='".UPLOAD_DIR.$userName."/".$image."' />";
$viewBlog .= " $comment</p>";
$viewBlog .= "</div>\n";
アップデート
私のjQuery -
$( "#dialog-view" ).dialog({
autoOpen: false,
height: 450,
width: 650,
modal: true,
buttons: {
Cancel: function() {
$( this ).dialog( "close" );
}
},
position: {
my: "center top",
at: "center top",
of: "#content"
}
});
$( ".view" ).click(function() {
$( "#dialog-view" ).dialog( "open" );
});
誰でもこれを理解するのを助けることができますか? ありがとうございました。