3 ">

Jsonp

软件发布|下载排行|最新软件

当前位置:首页IT学院IT技术

Jsonp

孙小龙   2020-03-15 我要评论

原生跨域请求数据

 1 <!DOCTYPE html>
 2 <html lang="en">
 3 <head>
 4     <meta charset="UTF-8">
 5     <title>Title</title>
 6 </head>
 7 <body>
 8 <div id="content"></div>
 9 <button onclick="jsonp()">提交</button>
10 
11 <script src="/static/jquery-1.11.0.js"></script>
12 <script>
13     function jsonp() {
14         var tag=document.createElement("script");
15         tag.src="http://www.jxntv.cnhttps://img.qb5200.com/download-x/data/jmd-jxtv2.html?callback=list&_=1454376870403";
16         document.head.appendChild(tag);
17         document.head.removeChild(tag);
18     }
19 
20     function list(arg) {
21         console.log(arg);
22     }
23 </script>
24 </body>
25 </html>
跨域请求数据HTML页面

 jQuery跨域请求数据

 1 <!DOCTYPE html>
 2 <html lang="en">
 3 <head>
 4     <meta charset="UTF-8">
 5     <title>Title</title>
 6 </head>
 7 <body>
 8 <div id="content"></div>
 9 <button onclick="jsonp()">提交</button>
10 <button onclick="ajax_jsonp()">ajax提交</button>
11 
12 <script src="/static/jquery-1.11.0.js"></script>
13 <script>
14     function ajax_jsonp() {
15         $.ajax({
16             url:"http://www.jxntv.cnhttps://img.qb5200.com/download-x/data/jmd-jxtv2.html?callback=list&_=1454376870403",
17             type:"GET",
18             dataType:"jsonp"
19         })
20     }
21 
22     function list(arg) {
23         console.log(arg);
24     }
25 
26 </script>
27 </body>
28 </html>
jQuery跨域请求数据

 

Copyright 2022 版权所有 软件发布 访问手机版

声明:所有软件和文章来自软件开发商或者作者 如有异议 请与本站联系 联系我们