首页 > Web开发 > 详细

Jquary 和Ajax实现简单的异步请求

时间:2017-07-22 19:19:05      阅读:351      评论:0      收藏:0      [点我收藏+]

代码:

<!DOCTYPE html>

<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Ajax测试</title>
     <link   rel="stylesheet" href="../demo1/bootstrap/css/bootstrap.css">
  <script src="jq/jQueryDownload/jquery.min.js"></script>
</head>
<body>
<button  id="sb"  type="button" class="btn btn-info">信息按钮</button>

<script>
 $(document).ready(function(){
        $("#sb").click(function(){
            $.post("http://localhost/demo2/test1.php",{
                        name:"印第安老斑鸠",
                        url:"http://www.laobanjiu.com"
                    },
                    function(data,status){
                        alert("数据: \n" + data + "\n状态: " + status);
                    });
        });
    });
</script>
</body>
</html>

 

Jquary 和Ajax实现简单的异步请求

原文:http://www.cnblogs.com/zhengweizhao/p/7222171.html

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