Collection of methods to prohibit Ajax caching in (ASP / PHP / JSP / HTML / JS)

Ajax caching has advantages, but it also has disadvantages. Caching can sometimes lead to misoperation and affect the user experience. If your web project does not need Ajax caching function, you can prohibit Ajax caching according to the following methods.

1、 Disable Ajax caching in ASP:

'at the beginning of the ASP page

2、 Disable Ajax caching in PHP:

3、 Disable Ajax caching in jsp:

4、 Force updates by adding random characters to web pages: for example

5、 For static HTML, add HTTP headers to prohibit caching, such as:

6、 You can disable Ajax caching by adding the following code before XMLHttpRequest sends the request:

7、 JQuery Ajax load disable

JQuery provides a method to prevent Ajax from using cache. You can solve the problem by adding the following statement to the JavaScript file of head.

Summary, but now we use jQuery Ajax. If we don't want the cache, we can directly set cache: false, which can solve the data submission methods such as post and get.

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>