frealy121212,
медитируйте ...
<!DOCTYPE HTML>
<html>
<head>
<title>Untitled</title>
<meta charset="utf-8">
<style type="text/css">
</style>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
<script>
$(function(){
var data = [
{"online": true,"players":"16/24","name" : "SSS"},
{"online": false,"players":"1/20","name" : "TTT"},
{"online": true,"players":"13/13","name" : "PPP"}
];//убрать
function fn(c) {
c = c.filter(function(a) {
return a.online
}).sort(function(a, b) {
return b.players.split("/")[0] - a.players.split("/")[0]
}).reduce(function(a, b) {
$("#monitoring").append("Игрок " + b.name + " результат : " +b.players + "<br>"); // b.name убрать
return a + +b.players.split("/")[0]
}, 0);
$("#monitoring").append("Итого : " + c)
};
fn(data);//это убрать ниже раскоментировать
/* $.getJSON('http://site.ru/file.json', fn); */
});
</script>
</head>
<body>
<div id="monitoring"></div>
</body>
</html>
|