我正在尝试使用 json/jsonp 为我未来的项目提出一个简单的请求,但我不知道我错过了什么。我已经通过http://jsonlint.com/验证了我的链接。如果我将链接替换为“http://search.twitter.com/search.json?q=earthquake&lang=en&callback=?” 有用。谢谢你。这是我的代码:
<html>
<head>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(function() {
$.getJSON('http://api.nytimes.com/svc/search/v1/article?format=json&query=cloud+computing&facets=des_facet%2Cper_facet%2Cgeo_facet%2Cclassifiers_facet%2Corg_facet&callback&api-key=b56e8aac267230a55c6f15cfeeb2cf4f:5:67104308&callback=?',
function(data){
var html = "<ul>Hello. This is my data.</ul>";
$('.nytimes').html(html);
});
});
</script>
</head>
<body>
<p>New York Times news</p>
<div class="nytimes">
</div>
</body>
</html>