0

当前带有视图锚的网格视图结构-我想在单击查看锚后查看特定行,数据应显示在弹出窗口中-javascript

当前带有视图锚的网格视图结构-我想在单击查看锚后查看特定行,数据应显示在弹出窗口中-javascript

下面是我的代码。我已经实现了 PHP Grid View 的功能,删除选项在顶部用查询字符串实现

现在我想要的是,单击视图后,它应该显示包含该特定行的所有详细信息的 javascript 弹出窗口,并关闭选项

没有得到的部分是如何将数据从 php/mysql 传输到 javaScript 并在弹出窗口中显示

if(isset($_GET['id'])){
    $id = $_GET['id'];
    //$x = 'confirm("Are you sure you want to delete this product")';
    //echo $x;
    mysql_query("DELETE FROM users WHERE id = '$id'");
    //echo "alert('Row Deletion Successful')";
}
?>
<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Table Display</title>

    <style>
table, td, th
{
border:1px solid green;
}
th
{
background-color:green;
color:white;
}
</style>
</head>
<body>

<table>
    <thead>
        <tr>
            <?php $result = mysql_query("SELECT id, CONCAT(title, ' ',  name) as FullName, email, mobile FROM users") or die(mysql_error()); 
            $row_count = 1;
            $row = mysql_fetch_assoc($result);
            echo '<td><input type="checkbox" /></td>';
            echo "<th> Sr. No </th>";
            foreach($row as $col=>$value)
            {

                echo "<th>";
                echo $col;
                echo "</th>";

            }
            ?>
            <th>EDIT</th>
        </tr>
    </thead>
    <tbody>
<?php 
mysql_data_seek($result, 0);
while($row = mysql_fetch_assoc($result)){
    echo "<tr>";
    echo '<td><input type="checkbox" /></td>';
    echo "<td>" . $row_count ."</td>";

    foreach($row as $key=>$value)
    {

    echo "<td>";
    echo $row[$key];
    echo "</td>";
}
    $row_count++;
    ?>

    <td>
            <a href="users.php?id=<?php echo $row['id']; ?>" onclick="return confirm('Are you sure you want to delete this product ?')" title="VIEW" class="icon-1 info-tooltip">VIEW | </a>
            <a href="users.php?id=<?php echo $row['id']; ?>" onclick="return confirm('Are you sure you want to delete this product ?')" name="delete">DELETE |</a>
            <a href="users.php?id=<?php echo $row['id']; ?>" title="EDIT" class="icon-5 strong-text info-tooltip">EDIT </a>
        </td>

    <?php


    echo "</tr>";
}   

echo "</table>";


?>


    </tbody>
</table>
</body>
</html>`
4

2 回答 2

2

您可以使用此代码在弹出窗口的记录中显示

 function openWin()
{
 myWindow=window.open('','','width=200,height=100');
 myWindow.document.write("<p>your code to display in table format</p>");
 myWindow.focus();
}
<a onclick="openWin();">Edit/Delete/View(any one)</a>

在 document.write() 方法中试试这个 在表格标签中输入你的代码

于 2013-08-05T05:09:33.843 回答
0

在页面中呈现特定视图(例如 viewpageaddress.php?id=7),然后通过以下方式在 js 中获取它的内容:

$.get('viewpageaddress.php?id=7', function(cnt){/* show cnt in your popup */})
于 2013-08-05T04:56:50.470 回答