jquery jsonp 跨域
来源:互联网 发布:ubuntu的串口调试工具 编辑:程序博客网 时间:2024/05/22 14:05
$.ajax( { type: 'get', url: url + "&uid=" + id, dataType: 'jsonp', jsonp: "callback", jsonpCallback: "cb", complete: function (XMLHttpRequest, textStatus) { var data = XMLHttpRequest.responseText; alert("data:"+data); alert('error: ' + textStatus); }, success: function (data) { alert('success'); }, error: function (e) { alert('fail'); } } );
注意:jsonpCallback 里写的是方法名,服务器端返回方法带参数
cb(json)
php端返回
echo $_GET['callback']."(".json_encode($data).")";
callback是传过来的参数名
阅读全文
0 0
- jQuery Ajax jsonp 跨域
- jquery之jsonp跨域
- jquery ajax跨域 jsonp
- jquery ajax jsonp 跨域
- jquery jsonp 跨域
- jquery ajax jsonp 跨域
- jquery jsonp 跨域
- jquery ajax跨域 jsonp
- jquery跨域 jsonp
- jquery jsonp 跨域
- jquery 跨域ajax jsonp使用方法
- AJAX跨域 jQuery JSONP 实践
- jquery 跨域 JSON和JSONP
- jquery 跨域 JSON和JSONP
- jquery-javascrip(jsonp) 跨域
- jquery实现的jsonp跨域
- jquery jsonp
- jQuery jsonp
- java commons库之一:基础库lang(1)
- Android高效加载大图、多图解决方案,有效避免程序OOM
- java规则引擎之easy rules源码阅读
- Codeforces 658C Bear and Forgotten Tree 3【思维】
- python-函数的参数
- jquery jsonp 跨域
- bzoj1597 [Usaco2008 Mar]土地购买(斜率)
- HTML基础知识
- 2017年前端面试题整理汇总100题
- web前端小知识和小技巧
- 虚幻引擎笔记
- android 中c/c++层用到的同步机制
- Android照片墙应用实现,再多的图片也不怕崩溃
- 有一分数序列:2/1,3/2,5/3,8/5,13/8,21/13...求出这个数列的前20项之和