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 }); |