我已经为我的网站购买了通知主题,我正试图从网站上获取一些数据,以通知登录的人。
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没有错误,但通知框实际上是按钮。他们可以修改吗?
答案 0 :(得分:0)
调试AJAX可能很痛苦。你必须清楚地了解 部件如何组合在一起:
所以有几个地方可能出现问题
有关如何使用firebug调试AJAX的教程,请参阅http://www.drdobbs.com/article/print?articleId=196802787&siteSectionName=tools