IE jquery Ajax cannot get the latest data on problem resolution (ie cache) _ajax related

Source: Internet
Author: User
Today, to modify a bug, using AJAX query data, Google Browser can get the latest data, and in IE to get the old data, can not get the latest data, after the search data, only to discover when IE cache mischief.
Found this Ajax request using the Get method, each request URL is exactly the same, IE browser has a special place, if each request of the same URL, will take out the cache already in the data displayed on the page, and will not go to query the database again, so each display is the old data.

Solution:
Then there are ideas, we can make it each request URL is not the same, you can add a parameter, and the value of this parameter each time is different, the time stamp is the best.
Copy Code code as follows:

URL: ' {0}/portal/articlemanager/getcontents?id={1}&date={2} '. Format (Window.baseurl, $ ("#id"). Val (), new Date () )

Where the ID is a useful parameter, and the date parameter we do not do processing.

Check the data learned that the Post method can be avoided in this issue, post is considered a variable access (browsers think that post submission, must be changed).
There is also a simpler way to set:
Copy Code code as follows:

Cache:false,

The premise is that the cache for this request does not exist yet.
Related Article

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.