Php Jquery表在插入时重新加载

Php Jquery表在插入时重新加载,php,jquery,html,mysql,ajax,Php,Jquery,Html,Mysql,Ajax,我正在关注这一点。我试图做的是让它在数据库中的表受到影响(插入、删除、更新)时,我的应用程序上的表将刷新,而不必按F5或刷新按钮。我按照教程走到发球台,但运气不好。什么也没发生。如果有人能检查一下我的代码,看看我的代码是否有问题,我将不胜感激 <head> <link href="core/styles/secondary.css" rel="stylesheet" type="text/css"/> <meta http-equiv="Conten

我正在关注这一点。我试图做的是让它在数据库中的表受到影响(插入、删除、更新)时,我的应用程序上的表将刷新,而不必按F5或刷新按钮。我按照教程走到发球台,但运气不好。什么也没发生。如果有人能检查一下我的代码,看看我的代码是否有问题,我将不胜感激

<head>
    <link href="core/styles/secondary.css" rel="stylesheet" type="text/css"/>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <script src="//ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
    <script type="text/javascript">
        $.ajaxsetup({
            cache: false
        })
        var ajax_load = "<img class='loading' src='core/images/load.gif' alt='Loading...'/>

        var loadURL="inoffice.php";
            $("#start_que").click(function(){
                $("#que").html(ajax_load).load(loadURL);
            });
     </script>

$.ajaxsetup({
缓存:false
})
var ajax_load=”
var loadURL=“inooffice.php”;
$(“#开始”)。单击(函数(){
$(“#que”).html(ajax_load).load(loadURL);
});
这是inoffice.php的表代码,我正在回显数据库中同一个表中的两个表,但视图不同(为null,不为null)



乍一看,主要问题似乎是您试图在呈现dom之前附加dom事件处理程序。请将所有代码包装在
$(document.ready()
中。当dom就绪时,将调用此函数,然后可以附加事件处理程序

除此之外,您遗漏了一些引号和分号,函数名应该是
ajaxSetup
,而不是
ajaxSetup

<script type="text/javascript">
    $(function () {
        $.ajaxSetup({
            cache: false
        });

        var ajax_load = "<img class='loading' src='core/images/load.gif' alt='Loading...' />";

        var loadURL = "inoffice.php";

        $("#start_que").click(function () {
            $("#que").html(ajax_load).load(loadURL);
        });
    });
</script>

$(函数(){
$.ajaxSetup({
缓存:false
});
var ajax_load=“”;
var loadURL=“inooffice.php”;
$(“#开始”)。单击(函数(){
$(“#que”).html(ajax_load).load(loadURL);
});
});

编辑:在您的解释中,您说第一个表来自inoffice.php,但是您的代码将inoffice.php列为加载第二个表的url。

您应该在这里有两个单独的文件。mainpage.php包含第一个表的代码,然后是inoffice.php,它只列出第二个表的html通过ajax加载的ond表。
echo 
    "<table border='2'>
    <tr>
    <th>ID</th>
    <th>A Number</th>
    <th>First Name</th>
    <th>Last Name</th>
    <th>Why</th>
    <th>Student Comments</th>
    <th>Signintime</th>
    <th>Staff Member</th>
    <th>Counselor Start Time</th>
    </tr>"
    ;

    foreach($result2 as $row2)
    {
  echo "<tr>";
  echo "<td>" . $row2['id'] . "</td>";
  echo "<td><a href=student.php?anum=" . $row2['anum'] . " target='_blank'>" .$row2['anum'] . " </a></td>";
  echo "<td>" . $row2['first'] . "</td>";
  echo "<td>" . $row2['last'] . "</td>";
  echo "<td>" . $row2['why'] . "</td>"; 
  echo "<td>" . $row2['comments'] . "</td>";
  echo "<td>" . $row2['signintime'] . "</td>";
  echo "<td>" . $row2['counselorname'] . "</td>";
  echo "<td>" . $row2['counselor_start_time'] . "</td>";
}

echo "</tr>";
echo "</table>";
<script type="text/javascript">
    $(function () {
        $.ajaxSetup({
            cache: false
        });

        var ajax_load = "<img class='loading' src='core/images/load.gif' alt='Loading...' />";

        var loadURL = "inoffice.php";

        $("#start_que").click(function () {
            $("#que").html(ajax_load).load(loadURL);
        });
    });
</script>