How to clear the cache in javascript: 1. Add relevant code in the head area of html; 2. Clear the temporary cache; 3. Set the attribute [cache:false] through [$.ajaxSetup].
The operating environment of this tutorial: Windows 7 system, JavaScript version 1.8.5, DELL G3 computer.
How to clear cache in javascript:
1, add code in the head area of html:
2, clear temporary cache
3. Two ways to clear the browser cache with jquery ajax:
1) Set the attribute cache:false through $.ajaxSetup to prevent ajax from calling the browsing cache.
jQuery.ajaxSetup ({cache:false})
2), add a random string after the ajax URL to avoid browsing cache, for example: $.ajax({url:'test.php?' parseInt(Math.random()*100000)} )cache.
Related free learning recommendations:javascript learning tutorial
The above is the detailed content of How to clear cache in javascript. For more information, please follow other related articles on the PHP Chinese website!