我为我的网站购买了一个通知主题,我正在尝试从网站获取一些数据以通知登录的人。
AJAX/jQuery/Javascript:
<script type="text/javascript">
var refreshId = setInterval(function(){
$.ajax({
type: "POST",
url: "cron/notify.php",
cache: false,
success: function(data){
$.smallBox(
{
var id = data[5],
title: "New Ticket",
content: "A new ticket has been created. Ticket ID: <strong>" +id+"</strong><p><h6>This will close in 4 Seconds.</h6>",
color: "#000",
timeout: 4000
});
}
setInterval(get_new, 1000);
</script>
PHP
<?php
mysql_connect(REDACTED FOR SECURITY) or die(mysql_error());
mysql_select_db(REDACTED FOR SECURITY) or die(mysql_error());
$query = mysql_query("SELECT * FROM tickets WHERE DATE_ADD(submitDate, INTERVAL 1 MINUTE) < CURTIME() AND currentStatus='Open'");
$array = mysql_fetch_row($result);
echo json_encode($array);
?>
我没有收到任何问题或错误。
更新:
<script type="text/javascript">
var refreshId = setInterval(function() {
$.ajax({
type: "POST",
url: "cron/notify.php",
cache: false,
success: function(data){
$("#botSimple1").click(function(){
$.smallBox(
{
title: "New Ticket",
content: "A new ticket has been created. Ticket ID: <strong>" +data[5]+"</strong><p><h6>This will close in 4 Seconds.</h6>",
color: "#000",
timeout: 4000
});
});
}
});
});
</script>
这是新脚本,JavaScript 没有错误,但通知框实际上是按钮框。它们可以修改吗?