saran

01 May 2010

Common problem with callbacks are parameters. You might have specified your callback but need to pass an extra parameter. The easiest way to achieve this is to wrap the callback inside another function:
// get some data
var foobar = …;

// specify handler, it needs data as a parameter
function handler(data) {
//…
}

// add click handler and pass foobar!
$(‘a’).