简体   繁体   English

加载 function 不加载新内容

[英]load function doesn't load a new content

div.load('test.txt');

Result - lorem ipsum - correct结果 - lorem ipsum - 正确

Now, after I change the content to dolor sit现在,在我将内容更改为dolor sit

div.load('test.txt');

result - lorem ipsum - incorrect结果 - lorem ipsum - 不正确

Obviously, there is a problem with caching content.显然,缓存内容存在问题。
How does one solve this?如何解决这个问题?

You can add a random query string each time, so the content is not cached.您可以每次添加一个随机查询字符串,因此内容不会被缓存。 The current date should be unique enough for this purpose.当前日期对于此目的应该足够独特。

div.load('test.txt?query=' + Date.now());

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM