update balance when buying items via javascript. fixes #10
This commit is contained in:
parent
1b7aaca19f
commit
9b18c4508e
|
@ -25,6 +25,13 @@ jQuery(document).ready(function($) {
|
||||||
}, options), callback);
|
}, options), callback);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
var updateBalance = function(newBalance) {
|
||||||
|
var balanceString = $("span.balance").text().split(": ");
|
||||||
|
balanceString[1] = parseFloat(newBalance).toFixed(2).replace(".", ",") + " €";
|
||||||
|
|
||||||
|
$("span.balance").text(balanceString.join(": "));
|
||||||
|
}
|
||||||
|
|
||||||
$.extend($.gritter.options, {
|
$.extend($.gritter.options, {
|
||||||
position: "bottom-right",
|
position: "bottom-right",
|
||||||
fade_in_speed: 250,
|
fade_in_speed: 250,
|
||||||
|
@ -61,6 +68,7 @@ jQuery(document).ready(function($) {
|
||||||
});
|
});
|
||||||
|
|
||||||
dataContainer.children().removeClass("locked");
|
dataContainer.children().removeClass("locked");
|
||||||
|
updateBalance(data.balance);
|
||||||
}, options);
|
}, options);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -121,7 +129,7 @@ jQuery(document).ready(function($) {
|
||||||
|
|
||||||
if(status === "success") {
|
if(status === "success") {
|
||||||
selected_item.addClass("success");
|
selected_item.addClass("success");
|
||||||
//TODO neuer kontostand wär schnaffte
|
updateBalance(data.balance);
|
||||||
} else {
|
} else {
|
||||||
selected_item.addClass("failure");
|
selected_item.addClass("failure");
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue