I’m getting a list of friends scores by calling the following:
https://graph.facebook.com/<appid>/scores?access_token=' + userToken;
It works great, but I would like to sort by highest score (result.score). There are lots of options for paging like “limit, offset, until” that you can specify inline in the URL, but I don’t see anything in the documentation for sorting.
If that’s not possible, what is the simplest way in jQuery or JavaScript to sort the following statement:
success: function (data) {
$("#highScores").html("");
$.each(data.data, function (i, item) {
$("#highScores").append("<div class='score'><span class='scoreName'>" + item.user.name + "</span><span class='scoreValue'>" + item.score + "</span>");
});
},
I just thought of one hack that I’ll use if someone doesn’t have a simpler solution.
save the last score, if new score is higher do prepend instead of append.