我有一个PHP程序,将计算时间差异,并在几分钟内返回值。
对于使用jGrowl的消息弹出窗口
所以我想要做的是获得返回值,如果它少于30分钟显示jquery消息。
最重要的是它应该是现场直播。所以如果用户在没有浏览或刷新的页面中,如果时间少于30分钟,则弹出窗口应当实时显示。
有人可以建议我如何使用返回值来达到上述要求吗?
下面如果我用来计算时间的代码有所不同
function time($dbtime, $currtime)
{
//format year-month-day hour:min:secs
$current = strtotime($currtime);
$indb = strtotime($dbtime);
$minits = round(abs($current - $indb) / 60,2);
return $minits;
}目前我只弹出日期的消息
(function($){
$(document).ready(function(){
// jGrowl
if ($.fn.jGrowl) {
// This value can be true, false or a function to be used as a callback when the closer is clciked
$.jGrowl.defaults.closer = function() {
console.log("Closing everything!", this);
};
// A callback for logging notifications.
$.jGrowl.defaults.log = function(e,m,o) {
$('#logs').append("
}
$.jGrowl("<?php echo $daily['calendars'][0]['Title']?>", { header: 'At <?php echo $daily['calendars'][0]['Start'];?>', sticky: true });
$.jGrowl.defaults.closerTemplate = '
}
});
})(jQuery);