I was trying to figure out how to sort an array provided by a php script. The php script gets the html files in a directory, and then passes them to jQuery, which then fetches them and displays them on the page. This is what I have:
<script>
$(document).ready(function(){
$.getJSON('helper.php', function(data) {
var items = [];
$.each(data, function(key, val) {
$.get("articles/" + val, function(html){
$("#postdata").append(html);
}, 'html');
});
});
});
</script>
How do I sort (or reverse) sort them? The filenames have the format {S}-post-slug.html, where {S} is the number of seconds after the epoch. I want to be able to display them with the latest file first.