我有以下代码pollastation
每 30 秒重新加载一次函数。
jQuery(document).ready(function() {
pollstation();
setInterval(pollstation, 30000);
});
我想要实现的是让这段代码每 30 秒检查一次以比较功能pollstation
,如果pollstation
内容相同则不刷新,如果不同则刷新。
我必须告诉你,我只知道基础知识JavaScript
。
我搜索了谷歌,并尝试使用下面的代码,但没有奏效。
jQuery(document).ready(function() {
pollstation();
pollstation.load(pollstation + Math.random());
var refreshId = setInterval(function () {
pollstation.load(pollstation + Math.random());
}, 30000);
$.ajaxSetup({
cache : false
});
});