Moved JSON money boxes to individual functions.

This commit is contained in:
James Cole
2015-04-11 07:24:07 +02:00
parent d8d92f147f
commit 1802bb967a
3 changed files with 145 additions and 120 deletions

View File

@@ -10,11 +10,11 @@ function drawChart() {
}
function getBoxAmounts() {
var boxes = ['in', 'out','bills-unpaid','bills-paid'];
var boxes = ['in', 'out', 'bills-unpaid', 'bills-paid'];
for (x in boxes) {
var box = boxes[x];
$.getJSON('/json/box', {box: box}).success(function (data) {
if(data.amount_raw != 0) {
$.getJSON('/json/box/' + box).success(function (data) {
if (data.amount_raw != 0) {
$('#box-' + data.box).html(data.amount);
}
}).fail(function () {