jsonp跨域请求
来源:互联网 发布:网络篮球游戏大全 编辑:程序博客网 时间:2024/06/06 01:26
1.引入jquery
2.
$.ajax({ url: rul, dataType: 'jsonp', jsonp: 'callback', //jsonpcallback注释掉的话 就会直接走success方法 jQuery做了封装 //jsonpcallback:'callback', success: function (data) { if(data.code == 0){ initContent(data.data); } }});
不用jQuery封装的方法也是可以的
/** * jsonp请求的方法 * @param srcUrl */function initScript(srcUrl) { var script = document.createElement("script"); script.type = "text/javascript"; script.src = srcUrl; document.getElementsByTagName("head")[0].appendChild(script);}var getRecords = 'http://www.baidu.com' + '?'callback=initAllRecords';initScript(tmpSrc);
阅读全文
0 0
- jsonp跨域请求
- jsonp 跨域请求
- jsonp跨域请求
- jsonp跨域请求
- jsonp跨域请求
- jsonp跨域请求
- JSONP 跨域请求
- jsonp跨域请求
- jsonp跨域请求
- JSONP跨域请求
- JsonP跨域请求
- jsonp跨域请求
- 跨域请求jsonp
- jsonp跨域请求
- JsonP跨域请求
- 跨域请求jsonp
- jsonp 跨域请求
- Jsonp跨域请求
- Docker初体验
- 激活引入非线性_池化预防过拟合(深度学习入门系列之十二)
- Servlet线程安全性问题
- 线段相交
- AM572x BuildingfullfeatureEtherCAT SlaveApplication
- jsonp跨域请求
- Spring 编程式事务管理
- CSDN如何转载别人的文章
- docker启动时服务自启动
- 0811 Java面向对象特征之多态
- 内部类_解释build()构造中使用静态内部类的原因
- SQL防火墙
- [编程题] 星际穿越
- ELK系统系列 1 ——ElasticSearch集群搭建