I've followed Karl Swedberg's article on rebinding events at learningjquery.com. The theory behind this technique is clear to me and I've got a working example.
function addItemFinal() { var $href = $('table caption a').attr('href'); var $rawmaandjaar = $href.split('&'); var $maand = $rawmaandjaar[0].split('='); var $jaar = $rawmaandjaar[1].split('='); $.get('includes/inc/ajax/fetchtable.php', { maand: $maand[1], jaar: $jaar[1] }, function(data) { $('div#agendawrapper').html(data); $('table caption a').unbind('click', addItemFinal).bind('click', addItemFinal); }); return false; } $('table caption a').bind('click', addItemFinal); The code in the function is pretty simple, it takes the href attribute and extracts some variables from it. With the variables it makes a GET request and in the callback it rebinds again. However is there more than one anchor in the caption and with the current code it just takes "table caption a" whereas this should be the actual link you clicked. I guess I should pass something to the function but it's used as a reference so I'm not sure how to achieve this... Someone who can help out?