Jquery $.getjson in IE under the cache problem solution
- 2020-03-30 04:05:35
- OfStack
At work, the data of the home page implementation Ztree Ztree is the JSON object returned in the background
Because the tree is fixed every time the tree is refreshed
The url for $.getjson is the same thing and I change or add a tree node and then refresh the tree IE and it doesn't change at all on other browsers
That's got me tangled up
Then I searched the Internet and found the solution
Solutions:
Jquery's $.getjson request has a caching mechanism that when requesting the same URL in the background it will fetch the data directly from the page cache rather than the request background
So we're going to change a URL
This is our URL, var URL = "XXXX/XXX"
Now let's do a method to generate random Numbers
function GetRandomNum(Min,Max)
{
var Range = Max - Min;
var Rand = Math.random();
return(Min + Math.round(Rand * Range));
}
And then change our URL
var i=GetRandomNum(1,100);
url=url+ " &random= " +i;
And then you plug in the URl and you solve the problem