[jQuery] Pass var to click event

[jQuery] Pass var to click event


I am having trouble passing a variable into a function used within a
click event. I am doing the following:
var test = 'Works!';
$('#action_confirm').click(function(test) {
alert(test);
});
I keep getting undefined. What am I doing wrong?