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>

猜你喜欢

转载自www.cnblogs.com/zhangzhengyang/p/11228269.html