Ajax cache Processing

Source: Internet
Author: User
Recently written ProgramYes. Sometimes, when Ajax is used, since the request page cannot be accessed, it does not go to the background. Code.........

After testing for a long time, I found that it should be a cache problem:

You can add:
XMLHTTP. setRequestHeader ("If-modified-since", "0 ");

Or if your background request page is a. ASPX page, you can directly set it without considering Caching:
<% @ Outputcache location = "NONE" %>
Page default:
The output cache can be located on the browser client that generates the request, the proxy server that participates in the request (or any other server), or the server that processes the request.
If this parameter is set to none, the cache is disabled.

I thought about the reason:
In fact, 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 submitted data or new data.

Of course, from the Internet, I also said that the value of the parameter passed for can be randomly changed so that the browser does not cache. I think it is also possible.

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.