我有以下脚本将 2 个提要组合在一起:
$(document).Ready(function() {
url = 'feed 1';
url_2 = 'feed 2';
$.when(
$.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'
}),
$.ajax({
type: "GET",
url: document.location.protocol + '//ajax.googleapis.com/ajax/services/feed/load?v=1.0&num=1000&callback=?&q=' + encodeURIComponent(url_2),
dataType: 'json'
})
).done(function(a1, a2) {
var data = a1[0].responseData.feed.entries.concat(a2[0].responseData.feed.entries);
if (data[0]) {
for (i = 0; i <= data.length - 1; i++) {
document.write(data[i].title);
document.write("<br>");
document.write(data[i].categories[0]);
document.write("<br>");
document.write(data[i].publishedDate);
document.write("<br>");
document.write(data[i].link);
document.write("<hr>");
}
}
else {
document.write("No records");
}
});
});
我该如何对加入的提要进行排序publishedDate
?
我想我应该使用jquery.sort
,但不知道如何在我当前的代码中使用它。