【发布时间】:2018-04-11 07:55:49
【问题描述】:
我正在努力更新我的 php 文件,即网站的索引页面(显示视觉效果并更新表格)。
我涉及三个文件,index.php 文件包含 html、php 和 javascript。
index.php文件中调用函数获取表变量的索引代码文件。
最后是 updatetable 文件,它从移动设备获取请求并更新表(以及许多其他内容,但我只是在简化)。
我一直在尝试与更新表文件中的索引文件进行通信,只是为了让它知道它应该更新它的表。但无济于事。
index.php
<table id= "ptable" class="packed-table" cellpadding="11"><tr><th>Order ID</th><th>Customer</th><th>Vendor</th><th>Address</th><th>Cart_ID</th><th>Cart</th><th>Fetched</th></tr>
<?php
function hope($packed){
while($row = mysqli_fetch_row($packed)){
echo "<tr id=".$row[0].">";
echo '<td>',$row[0],'</td>';
echo '<td>',$row[1],'</td>';
echo '<td>',$row[4],'</td>';
echo '<td>',$row[7],'</td>';
echo '<td>',$row[2],'</td>';
echo '<td>',"items",'</td>';
?>
<td>
<button id="buttonfetched" onclick='orderFetched("<?php echo $row[0]; ?>","<?php echo $row[2]; ?>")' name="fetched" >Fetched</button>
</td>
</tr>
<?php } }
$packed = $ic->packed();
hope($packed);
?>
</table>
我尝试调用此函数,但由于某种原因,它只是将整个 html 文档返回到我的移动应用程序。
任何帮助或指导将不胜感激。
【问题讨论】:
-
XMLHttpRequest可能有用吗?