1. home.html
<!DOCTYPE html> <html> <head> <title>home</title> <meta http-equiv="Content-Type" content="text/html"; charset="utf-8" /> <script type="text/javascript" src="js/jquery-1.11.3.js"></script> <script> $(function(){ $("#dianji").click(function(){ // console.log("test"); // alert("testtst"); $("#content").load("test.html"); }); }); </script> </head> <body> <p id="dianji">点击获取load内容</p> <p class="comment" id="content">这里是内容</p> </body> </html>
test.html
<div class="comment" id="test"> <h6>张三:</h6> <p class="para">沙发.</p> </div> <div class="comment"> <h6>李四:</h6> <p class="para">地板.</p> </div> <div class="comment"> <h6>王五:</h6> <p class="para">板凳.</p> </div>
时间: 2024-10-29 19:07:28