Jquery AJAX对变化提出警告

时间:2017-04-23 04:46:29

标签: javascript php jquery ajax

如果另一个数据添加到数据库,如何提醒? 在这种情况下,每隔一秒就会有一个警告我如何应用它来获取另一个数据时的通知。

$(document).ready(function() {
    setInterval(function() {
        $.get('functions/today_sched.php', function (data) {
            $('#today').html(data);
            alert('change')
        });
    }, 1000); 
});

HTML

<div id = "today"></div>

today_sched.php

<?php 
                $con = mysqli_connect("localhost","root","","schedule");
                $date = date("d/m/Y");

                $count=1;
                $sel_query="Select * from today_schedule where date = '$date'";
                $result = mysqli_query($con,$sel_query);



                while($row = mysqli_fetch_assoc($result)) {
                <tr>
                  <td>echo $row['date'];</td> 
                </tr>
                $count++;
                }
?>

0 个答案:

没有答案