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