Introduction to the page Ajax method $. load function in jquery, jquery. load
Load syntax
$ (". Selector"). load ("url", function (responseText, statusText, xmlhttprequest ));
When loading a page, if an error occurs, the corresponding prompt is displayed based on the status given by statusText, which is very important to the user.
For example, load post
The Code is as follows:
Copy codeThe Code is as follows:
<Div id = btnAjaxPost> click me </div>
<Div id = divResult> loading content </div>
$ ("# BtnAjaxPost"). click (function (event)
{
Var username = $ ("# username"). val ();
// Send a Post request
$ ("# DivResult"). load ("$ (www.jb51.net) {ctx}/jqueryLoad", {"username": username });
});
Example: load get Method
The Code is as follows:
Copy codeThe Code is as follows:
<Div id = in_head> loading content <Script language = "javascript"> $ ('# in_head'). load ('ajaxlogin. php? Cityid = 1208 '); </script>
Ajax method $. load garbled
Generally, the load garbled characters are caused by the two page codes. The processing method is
1.my display page index.html encoding is a uft-8;
2.my Static Page foot.html code is a uft-8;
$ ("# Index_foot_container"). load ("foot.html ");
How does jquery ajax submit data in the load () Incoming "page" and return results without refreshing?
Use ajax requests in your load () method.
$. Ajax ({
Type: "POST ",
DataType: "json ",
Url: "Request Path ",
Data: "parameter ",
Success: function (result ){
If (result ){
// Result returned by the request
}
}
});
The load () method of jquery ajax cannot obtain page content
I won't talk about the answer upstairs. I'll just say that your IE is ineffective.
In ie, the load () method gets the cached data instead of the server.
Add this js sentence at the beginning of the script so that ie does not read the cache. If it is only a method that uses load (), add this sentence before load () without the need for global settings.
$. AjaxSetup ({cache: false });
I don't understand. Please ask. If it is helpful, remember to adopt it ~