直到昨天,这段代码才有效。但今天我有这个错误:
TypeError:xml.responseData为null
CODE:
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
<script>
$(function(){
var object001 = new Object();
url = 'https://news.google.com/news?cf=all&hl=en&pz=1&ned=us&csid=09160b44f4732e03&output=rss';
$.ajax({
type: "GET",
url: document.location.protocol + '//ajax.googleapis.com/ajax/services/feed/load?v=1.0&num=1000&callback=?&q=' + encodeURIComponent(url),
dataType: 'json',
error: function(){
alert('Error!');
},
success: function(xml){
var values = xml.responseData.feed.entries;
console.log(values);
}
});
});
</script>
任何人都知道为什么?谢谢!