jquery requests IE cache, data does not update the issue of "Ajax disable caching to resolve IE data not updating issues"

Source: Internet
Author: User

In doing Ajax page without refreshing add, ie under the AJAX cache, because at first didn't know that IE has this bad problem, toss for a long time, finally solve the problem. Summarize the solution:

Under IE, the use of Ajax to request a page, usually because of the cache for the reason and return to the previous result, causing confusion, [ that is, get the data when it gets, because the sending parameters and address are consistent, so IE browser will be taken from the cache, Instead of requesting the server side, the post method does not produce this problem because of the parameters, but this does not happen under FF. To be unaffected by the cache, you can do this:

IE Access policy: Internet Options--browsing history--settings--Options for temporary Internet files are changed every time you visit a webpage

1: Add a random function to the page after the AJAX request, we can use the random time function

Add T=math.random () after the URL sent by javascript

For example: url+ "&" + "t=" +math.random (); or new Date ();

After the URL parameter, add "? timestamp=" + New Date (). GetTime ();

The best way:

$.ajaxsetup ({cache:false})

This is done for all AJAX requests on the page. You do not have to change the finished n interfaces ... Encountered when doing PH project

If you are performing an AJAX modification, take into account the speed of the Ajax problem, be sure to invoke the query in the Ajax execution callback function. The execution of the command for Ajax is complete and the data is modified successfully

If the query statement is not written in the Ajax callback function, but written behind. The data appears and the query is executed for modification. resulting in inaccurate data.

jquery requests IE cache, data does not update the issue of "Ajax disable caching to resolve IE data not updating issues"

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.