【发布时间】:2015-08-28 14:54:54
【问题描述】:
我想知道如何实现以下项目
实际上我有一个呈现表格的 php 代码
<table id = "oldata" class ="table table-bordered">
<thead>
<tr class ="success">
<th class="text-center">Stage</th>
<th class="text-center">REQUEST</th>
<th class="text-center">REPLY</th>
</tr>
</thead>
<tbody>
<?php
foreach($allinfool as $infool){
print("<tr>");
print("<td>{$infool["Stage"]}</td>");
print("<td class='text-left'>" .nl2br($infool["comment"])."</td>");
print("<td class='text-left'>" .nl2br($infool["resultcom"]). "</td>");
print("</tr>");
}
?>
</tbody>
</table>
到目前为止一切顺利,但是我想根据用户的操作构建许多类似上面的表。 我的意思是他将有一个项目列表(如选项 1、选项 2、选项 3...),然后单击此选项将呈现而不重新加载 html 上方的页面(基于新的 allinfool 数组)。
我的意思是我想通过 Ajax 来实现。到目前为止,我可以管理 Ajax,但不能呈现 html 的上述内容。 我可以设法返回一个数字或一个文本,但在这种情况下它更复杂,因为 html 与 php 混合在一起。 您能帮我弄清楚如何实现这种 Ajax 技术吗?
【问题讨论】: