我有一张表,我使用PHP的数据从MySQL填充数据。数据表不能正常工作
<table id="tab" class="table">
<thead>
<tr>
<th>Heading</th>
</tr>
</thead>
<tbody>
<?php
session_start();
$id=$_SESSION['id'];
$val=$_SESSION['val'];
if($val=="1")
{
$result = $obj->getAllVals();
}
else
{
$result = $obj->getVal($id);
}
foreach($result as $row) { ?>
<tr style="cursor:pointer" onclick="gp('<?php echo $row['name']; ?>')">
<td> <?php echo $row['name']; ?> </td> </tr>
<?php } ?>
</tbody>
</table>
我无法将我的数据看作数据表。下面是我打电话数据表:
$(document).ready(function() {
$('#tab').dataTable();
});
下面是我使用的脚本:
<script src="static/js/jquery.js" type="text/javascript" charset="utf-8"></script>
<script type="text/javascript" src="static/lib/jquery.dataTables/js/jquery.dataTables.min.js"></script>
<script type="text/javascript" src="static/lib/jquery.dataTables/js/DT_bootstrap.js"></script>
<script type="text/javascript" src="static/lib/jquery.dataTables/js/datatables.responsive.js"></script>
<script src="static/js/jquery-ui.js" type="text/javascript" charset="utf-8"></script>
什么解决的情况下,是你得到的错误。 –
检查控制台是否有错误 –
我看不到$ obj对象 - 你能发布完整的代码吗? –