我将尝试实现的是:最初数据将被加载,然后使用相同的函数每十分钟进行更新。
考虑以下代码:
我收到了这个错误信息:
考虑以下代码:
var updateNamespace = (function() {
var object = '#updates',
load = 'loader';
return {
update: function() {
$(object).addClass(load).load('update.php', function(reponse, status, xhr) {
if (status == 'error') {
$(this).html('<li>Sorry but there was an error in loading the news & updates.</li>');
}
$(this).removeClass(load);
});
}
}
})();
setInterval(updateNamespace.update(), 600000);
我收到了这个错误信息:
useless setInterval call (missing quotes around argument?)
我该如何解决这个问题?
有没有更好、更优雅的编写方式或者使用 setInterval
函数的方法?
谢谢。