I have always went with the inline onclick approach as such:
<a href="#" id="do-something" onclick="doSomething(<?= $row['id'] ?>); return false;">
But I notice this isn't what the majority of websites do. They tend to do this:
<a href="#" id="do-something">
$("#do-something").click(function(e) {
e.preventDefault();
doSomething();
// --------^
})
The only problem is, how do I get the parameter that I supplied in example one so I can use it in example two? What's the correct process? Maybe add some hidden divs?