JQuery Ajax Load Shutdown caching method

Source: Internet
Author: User

Briefly describes the load (url,data,function (RESPONSE,STATUS,XHR)) parameter description
The URL stipulates which URL to send the request to.
Data is optional. Specify the data to be sent to the server along with the request.
function (RESPONSE,STATUS,XHR) is optional. Specify the function to run when the request completes.

Additional parameters:

response-Contains the result data from the request
status-Contains the requested status ("Success", "Notmodified", "Error", "timeout" or "ParserError")
XHR-Contains XMLHttpRequest objects

JQuery Load Sample code:

The code is as follows Copy Code

$ (document). Ready (function () {
$ ("#labels"). Load ("/blog/categories/labels.html");
Inserts the contents of the labels.html in the DOM element with ID #labels when the page is loaded.
});

When I update labels.html, the Load method in IE7 is still using the old labels.html, even if I press the Refresh key, it doesn't work. Fortunately jquery provides a way to prevent Ajax from using caching, and adding the following statement to the head's JavaScript file can solve the problem.

The code is as follows Copy Code

$.ajaxsetup ({
Cache:false//Turn off AJAX-appropriate caching
});

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.