One, jquery how to load an HTML page into the div i specified. (from Baidu know)I want to load some part of the a.html into a div in b.html.
For example, I'm going to load a.html inside the <div id= "acontent" ></div> this div inside of all content loaded into the b.html div <div id= "Rightcon" ></ Div>
How would you like to write it?
With jquery Ajax can do
Suppose A.html and b.html in the same directory
B.html
<script >
$ (document). Ready (function () {
Bodycontent = $.ajax ({
URL: "B.html",
Global:false,
Type: "POST",
Data: ({
Id:this.getAttribute (' acontent ')
}),
DataType: "HTML",
Async:false,
Success:function (msg) {
Alert (msg);
}
})
});
</script>
Second, Juqery $.ajax request another HTML page designated "part" loaded into this page div, the focus is part of the data loaded into this page div (from Baidu know) to the idea as follows:
$.ajax ({
Url:url,//This is the address of the static page
Type: ' Get ',///static page is used with gets method, otherwise the server throws 405 error
Success:function (data) {
var result = $ (data). Find ("a specified part of another HTML page");
$ ("this page div"). html (result);
}
});
or refer to the following code:
$ (function () {
$.ajax ({
Type: "POST",
URL: "Loginloadarticle.ashx",
Data: "Type=" +escape ("latest announcement"),
Success:function (msg) {
$ (". Gonggao"). HTML (msg);
},
Error:function (XMLHttpRequest, Textstatus, Thrownerror) {}
})
})
If the parameters are not clear you can refer to
three, jquery $.ajax () method parameter detailed http://blog.csdn.net/chelen_jak/article/details/22742567