Jquery $.getjson in IE cache problem

Source: Internet
Author: User

At Work the home page implements Ztree Ztree data is the JSON object returned in the background

Because the tree is fixed, every time we refresh the tree

$.getjson URLs are the same problem I modified or added a tree node and then refreshed the trees IE has no change in other browsers are OK

It's got me tangled up.

and then we searched the Internet for data discovery Solutions.

Workaround:

Jquery's $.getjson request has a caching mechanism that takes the data from the page cache directly to the background when requesting the same URL, instead of requesting the background

So we're going to change a URL

This is our url var url = "Xxxx/xxx"

Here's a way to generate a random number

function Getrandomnum (Min,max) {   var Range = max-min;   var Rand = Math.random ();   Return (Min + math.round (Rand * Range));   
and change our URLs.

var i=getrandomnum (1,100);

url=url+ "&random=" +i;

And then put the URL in it to solve the problem.

Jquery $.getjson in IE cache problem

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.