Home > Article > Web Front-end > Introduction to the function of page Ajax method $.load in jquery_jquery
load syntax
$(".selector").load("url", function(responseText, statusText, xmlhttprequest));
When loading a page, if an error occurs, the corresponding prompt will be displayed based on the status given by statusText, which is very important for users.
Example, load post
The code is as follows
$("#btnAjaxPost").click(function(event)
{
var username = $("#username").val();
//Send Post request
$("#divResult").load("$(www.jb51.net){ctx}/jqueryLoad", { "username": username});
});
The code is as follows
Generally, the reason why the load is garbled is because the encoding of the two pages does not affect it. The solution is
1. The encoding of my display page index.html is uft-8;
2. The encoding of my static page foot.html is uft-8;
$("#index_foot_container").load("foot.html");