Home > Article > Web Front-end > Jquery $.getJSON solution to caching problem under IE_jquery
Implement Ztree on the homepage at work. The data of Ztree is the JSON object returned by the background
Because the tree is fixed, the tree is refreshed every time
The URLs of $.getJSON are all the same. Here comes the problem. I modify or add a new tree node and then refresh the tree. There is no change in IE. It is OK in other browsers
This makes me confused
Then I searched the Internet and found the solution
Solution:
Jquery's $.getJSON request has a caching mechanism, that is, when requesting the same URL to access the backend, it will directly retrieve the data from the cached data of the page instead of requesting the backend
So we have to change a URL
This is our URL var url="XXXX/XXX"
Here’s a method to generate random numbers