不知道我在这里错过了什么,如果你看看这段代码 - 你会看到我正在对flickr进行jsonp调用并获得成功的响应。但是,jQuery总是调用“失败”方法而不是成功方法。为什么jQuery说我的ajax jsonp调用失败?
为什么?
{{EDITED}}
$.ajax({
url: 'http://api.flickr.com/services/feeds/photos_public.gne?format=json&tags=fun&tagmode=any',
dataType: 'jsonp'
})
.done(function(data, status) {
console.log('data count:', data.query.results.json.json.length);
$('#result-count').text(JSON.stringify(data.query.results.json.json));
})
.fail(function(xhr, err) {
console.log('Sample of error data:', err);
console.log("readyState: "+xhr.readyState+"\nstatus: "+xhr.status+"\nresponseText: "+xhr.responseText); });
});
为什么'async:false'?这就是'AJAX'中的'A'所代表的! – 2013-02-11 18:28:24