我想比较两个变量,oldRefresh和newRefresh。输入中oldRefresh的值很容易oldRefresh通过键入来存储var oldRefresh= $('#oldrefresh').val();
但是newRefresh, 很难得到它,我需要从另一个文件中得到它.load();
这是代码:
var oldRefresh= $('#oldrefresh').val();
setInterval(function ()
{
$('#noti_number').load('include/js_notification_count.php?n=".$_SESSION['username']."');
});
}, 5000);
我试过这个:
var newRefresh = setInterval(function ()
{
$('#noti_number').load('include/js_notification_count.php?n=".$_SESSION['username']."');
});
}, 5000);
alert(newRefresh);
这个结果就是2当负载它应该的结果0。
所以我尝试了这个
setInterval(function ()
{
var newRefresh = $('#noti_number').load('include/js_notification_count.php?n=".$_SESSION['username']."');
});
alert(newRefresh);
}, 5000);
这样做的结果是[object Object]。我不明白。如何将load值放入变量中?