Ajax学习笔记(2)--load()方法

 1 <head runat="server">
 2     <title></title>
 3     <script src="http://localhost:3369/Scripts/jquery-1.4.1.min.js" type="text/javascript"></script>
 4     <script type="text/javascript">
 5         $(function () {
 6             $("#send").click(function () {
 7                 //无参数传递,GET方式
 8                 //$("#reText").load("test.htm");
 9 
10                 //筛选部分元素
11                 $("#reText").load("test.htm .comment1");
12             });
13 
14         });
15     
16     </script>
17 </head>
View Code
 1 <body>
 2     <div class="comment">
 3         <h2>
 4             张晓红:</h2>
 5         <p class="para">
 6             青菜</p>
 7     </div>
 8 
 9     <div class="comment1">
10         <h2>
11             刘龙龙:</h2>
12         <p class="para">
13             罗卜</p>
14     </div>
15 
16     <div class="comment">
17         <h2>
18             田欣欣:</h2>
19         <p class="para">
20             香菇</p>
21     </div>
22 </body>
View Code

jQuery中$.ajax()方法属于最底层的方法

第二层是load()方法,$.get()和$.post()方法

第三层是$.getScript()和$.getJSON()方法

原文地址:https://www.cnblogs.com/hshuai/p/4268965.html