如果在服务器上发生更改,ajax每秒请求页面自己的url,然后检查textStatus
是否为notmodified
,我试图使页面重新加载。如果在服务器上修改了重新加载页面
setTimeout(function(){
$.ajax({
url : window.location.pathname,
dataType : "text",
ifModified : true,
success : function(data, textStatus) {
if (textStatus !== "notmodified") {
location.reload();
}
}
});
}, 1000);
然而,textStatus
总是success
检查您的服务器的缓存标头。 – SLaks 2013-02-15 14:41:52
我使用[Mongoose](http://code.google.com/p/mongoose/)作为Web服务器。 – Theodor 2013-02-15 14:53:05