Last active
December 11, 2015 23:38
-
-
Save ollieglass/4678115 to your computer and use it in GitHub Desktop.
AJAX helper for categorising credit card transactions, from my personal finance mini-hackathon http://ollieglass.com/2013/01/30/personal-finance-mini-hackathon
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var setCategory = function(transactionId, categoryId) { | |
$.ajax({ | |
type: "GET", | |
url: "/transaction/", | |
data: { | |
transactionId: transactionId, | |
categoryId: categoryId | |
} | |
}).done(function( msg ) { | |
console.log(msg); | |
}); | |
}; | |
$(function() { | |
$("select").change(function() { | |
var transactionId = $(this).data('value'); | |
var categoryId = $(this).val(); | |
if(categoryId == -1) return; | |
setCategory(transactionId, categoryId); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment