How I view every contents in jquery dialog using php -


i creating table using php , how create table body.

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 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 comment'></span>\n";     $html .= "      </a>\n";     $html .= "  </td>\n";                            $html .= "  <td align='center'>\n";     $html .= "      <a href='#'>\n";     $html .= "          <span class='delete' title='delete comment'></span>\n";     $html .= "      </a>\n";     $html .= "  </td>\n";     $html .= "</tr>\n";  }  

using table there 3 columns view, edit , delete each comments. want trigger jquery dialog each action. tried work view dialog. display 1 comment each link. added code view dialog in while loop -

//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"; 

update

my jquery -

$( "#dialog-view" ).dialog({         autoopen: false,         height: 450,         width: 650,         modal: true,         buttons: {             cancel: function() {             $( ).dialog( "close" );             }         },          position: {              my: "center top",              at: "center top",             of: "#content"         } });   $( ".view" ).click(function() {     $( "#dialog-view" ).dialog( "open" ); });  

can figure out. thank you.

if add code dialog inside while loop, have created multiple dialog. of them same id dialog-view. first occurrence loads.

you can achieve opening specific dialog appending variable eg: $i follows

//create view blog dialog box  $viewblog  = "<div id='dialog-view-$i'>\n"; 

then in first while loop,

<span class='view' onclick='$(\"#dialog-view-$i\").dialog(\"open\");' title='view comment'></span>\n"; 

Comments

Popular posts from this blog

java - Run a .jar on Heroku -

java - Jtable duplicate Rows -

validation - How to pass paramaters like unix into windows batch file -