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 code |
|
<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 ("$ {ctx}/jqueryLoad", {"username": username });
}); |
Example: load get method
| The code is as follows: |
Copy code |
|
<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 ");