有没有办法通过ajax将http://search.twitter.com/search.json网址提供的json加载到我的页面?我试过的一切都给了我:
XMLHttpRequest cannot load http://search.twitter.com/search.json. Origin null is not allowed by Access-Control-Allow-Origin.
如果没有,那么最初是否有这样的服务?W
答案 0 :(得分:3)
使用JSONP
或JSON填充:
<script type = "text/javascript">
window.getTwitterResults = function(data) {
console.log(JSON.stringify(data));
};
</script>
<script type = "text/javascript" src = "http://search.twitter.com/search.json?q=cheese&callback=getTwitterResults"></script>