jquery的ajax的语法

 1 <!doctype html>
 2 <html lang="en">
 3 <head>
 4     <meta charset="UTF-8">
 5     <title>jquery-ajax</title>
 6 </head>
 7 <body>
 8 <input type="button" value="点击" id="btn">
 9 <div id="showInfo"></div>
10 <script type="text/javascript" src="jquery-1.11.2.js"></script>
11 <script type="text/javascript">
12     $(function(){
13 
14         $("#btn").click(function(){
15             $.ajax({
16                 url:"04data.php",
17                 dataType:"json",
18                 type:"get",
19                 success:function(data){
20                     alert(data);
21                     
22                 },
23                 error:function(e){
24                     console.log(e);
25                 }
26             });
27         });
28 
29 
30 
31     });
32 
33 </script>
34 </body>
35 </html>
原文地址:https://www.cnblogs.com/sanerandm/p/8358980.html