How To Disable IE caching and use Ajax technology to update data in a timely manner

Source: Internet
Author: User
When I was working on an Ajax project today, I found a problem: After submitting data, I cannot retrieve the submitted data. After careful analysis, the system finds that there is no message to retrieve data in the background logs, and the frontend does not prompt "reading data. Therefore, it should be a problem of system cache, So Google will solve it. The method is as follows:

Method 1: Add response. setheader ("cache-control", "No-cache, must-revalidate") to the server code ");

Method 2: javascript is used to add a random number as a parameter in the URL when Ajax is submitted. Req. Open (URL + "&" + math. Random ).

Cause: in IE, if the URL submitted by XMLHttpRequest is the same as that in history, the cache is used and it is not submitted to the server. Therefore, you cannot obtain the data you just submitted.

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.