I have the following script which combines 2 feeds together:
$(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");
}
});
});
How do I go about sorting the joined feeds by publishedDate?
I think I'm supposed to use jquery.sort, but can't figure out how to use it with my current code.