Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save ollieglass/4678115 to your computer and use it in GitHub Desktop.
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
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