i am currently having certain hyperlinks in VF page which i need to make compatible in service cloud and hence using the API toolkit.I am quite new to callback methods, what is the syntax to pass arguments into the callback method.Any help will be very useful, below is the current code i am using which is working fine but its doesn't take any arguments. Is there a way i can use like openReportedContact('{!caserec.id'}) and use this parameter in the callback function callBackopenReportedContact(result,'{!caserec.id'}) as well. The purpose is to write a generic JS method, curretnly i have 3 JS method doing the same work and want to write one generic JS.
VF Page
<A HREF="#" onClick="openReportedContact();return false">{!caserec.contact.name}</A>
function openReportedContact() {
if(!sforce.console.isInConsole())
window.parent.location.replace('/{!case.ContactId}');
else sforce.console.getEnclosingPrimaryTabId(callBackopenReportedContact);
}
function callBackopenReportedContact(result) {
sforce.console.openSubtab(result.id, '/{!case.ContactId}',true,'{!case.contact.name}', null);
};