jQuery - when paid checkbox is checked/unchecked database is updated.

Color changes, too.
This commit is contained in:
Jonathan Rosenbaum
2014-12-26 06:26:26 +00:00
parent 87eb7fba3a
commit 508ed7c3b9
4 changed files with 51 additions and 2 deletions
+20
View File
@@ -0,0 +1,20 @@
/* jQuery fun with transactions - Jonathan Rosenbaum */
// currently css is just hardwired, but that reflects the coding style of YBDB :)
$(function() {
$(".paid").click(function() {
if ($(this).prop("checked")) {
//console.log("turn color on");
$(this).closest("tr").css("background-color","#99CC33");
$.post("json/transaction.php",{ paid: 1, transaction_id: this.name } );
}
else {
//console.log("turn color off");
$(this).closest("tr").css("background-color","transparent");
$.post("json/transaction.php",{ paid: 0, transaction_id: this.name } );
}
});
});