jquery的jsonp

 1 <body>
 2    <button id="btn">点击</button>
 3 <script src="js/jquery.js"></script>
 4 <script>
 5     $(function () {
 6        $('#btn').click(function () {
 7            $.ajax({
 8                type: "get",
 9                url: "http://localhost:3000/",
10                dataType: 'jsonp',
11                jsonp: 'callback',//
12                jsonpCallback: 'acb',//
13                success: function(data){
14                    console.log(data);
15                }
16            });
17        });
18     });
19 </script>
20 </body>

 

posted @ 2019-07-22 20:43  疏影横斜水清浅  阅读(624)  评论(1编辑  收藏  举报