To append rows to existing table. On each onclick had to pass the selected object.
function populateResult(data, resultElementId){
$.each(data, function(i,row){
$tr = $('<tr><td>'+ row.name+'</td></tr>' ).appendTo(resultElementId);
$tr.on("click", myfunction(row));
});
}
function myfunction(shipObj){
console.log("data :"+JSON.stringify(shipObj));
}
myfunction this method is not invoking on onclick.
Note: I am using jquery 1.7