首页 > Web开发 > 详细

jquery的ajax的语法

时间:2018-01-26 13:32:42      阅读:225      评论:0      收藏:0      [点我收藏+]
 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                     //$("#showInfo").html(data);
22                 },
23                 error:function(e){
24                     console.log(e);
25                 }
26             });
27         });
28 
29 
30 
31     });
32 
33 </script>
34 </body>
35 </html>

 

<!doctype html><html lang="en"><head><meta charset="UTF-8"><title>jquery-ajax</title></head><body><input type="button" value="点击" id="btn"><div id="showInfo"></div><script type="text/javascript" src="jquery-1.11.2.js"></script><script type="text/javascript">$(function(){
$("#btn").click(function(){$.ajax({url:"04data.php",dataType:"json",type:"get",success:function(data){alert(data);//$("#showInfo").html(data);},error:function(e){console.log(e);}});});


});
</script></body></html>

jquery的ajax的语法

原文:https://www.cnblogs.com/sanerandm/p/8358980.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!