How to solve the Ajax caching problem
This article mainly introduces "how to solve the Ajax cache problem". In the daily operation, I believe many people have doubts about how to solve the Ajax cache problem. The editor consulted all kinds of data and sorted out simple and easy-to-use operation methods. I hope it will be helpful for you to answer the doubts about "how to solve the Ajax cache problem"! Next, please follow the editor to study!
1. Add anyAjaxObj.setRequestHeader ("If-Modified-Since", "0") before ajax sends the request.
2. Add anyAjaxObj.setRequestHeader ("Cache-Control", "no-cache") before ajax sends the request.
3. Add a random number after URL: "fresh=" + Math.random ();.
4. Add time rub after URL: "nowtime=" + new Date (). GetTime ();.
5. If you are using jQuery, you can just do this for $.ajaxsetup ({cache:false}). In this way, all ajax of the page will execute this statement, but there is no need to save the cache record.
At this point, the study on "how to solve the Ajax cache problem" is over. I hope to be able to solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!