ant*_*paw 3 javascript ajax jquery youtube-api cross-domain
$(document).ready(function(){$ .ajax({url:" http://gdata.youtube.com/feeds/api/users/zdf/playlists?v=2 ",输入:"GET", success:function(msg){console.log(msg);}});});
我收到此错误"XMLHttpRequest无法加载http://gdata.youtube.com/feeds/api/users/zdf/playlists?v=2 "
如何进行跨域ajax调用以从api获取xml?
您无法进行跨域调用以获取XML.您唯一选择接收数据跨域的是JSON-P.
该same origin policy限制对外国域直接访问(AJAX/I帧),json-p使用dynamic script tag insertion来解决此问题.
看看http://api.jquery.com/jQuery.getJSON/.JSON-P也在那里.
编辑
http://code.google.com/intl/de-DE/apis/youtube/2.0/developers_guide_json.html
为你而制作!
| 归档时间: |
|
| 查看次数: |
3357 次 |
| 最近记录: |