Because the beginning does not understand jquery, always want to use Jquery.load method load new page, in order to achieve local refresh, the results found in the page loaded in with the original separate page is not the same, the style is gone, and then checked on the Internet, found a solution, this is someone else's answer:
Yes, if you do not filter out some content, direct loading, will make the page confusing, such as the new page also exists <body> tags, loading in, a page will exist two <body> tags are not standard HTML. This is specified in the Jquery.load () function. Normally loaded pages need to redefine CSS styles and add JS events based on the elements of the loaded content. Like what:
Original page a.html:
Copy Code code as follows:
<body>
<div id= "Container" ></div>
</body>The page b.html by load:
<style>.page-li {font-size:12px;color:blue}</style>
<body>
<div id= "Page" >
<ol class= "Page-li" >
<li>234123</li><li>341234</li><li>41234</li><li>412de34</li>
</ol>
</div>
</body>
Load the Jquery.load () of the call in the original page a.html, and then redefine the Page-li style on the original page:
Added load (), CSS's original page:
<style>.page-li {font-size:12px;color:green}</style>
<body>
<div id= "Container" ></div>
<script type= "Text/javascript" >
$ (function () {
$ ("#container"). Load ("b.html #page", Null,function () {alert ("Loaded Successfully")});
});
</script>
</body>
I hope it will help you.