Mvc3 append javascript function to link in html table generated from JSON
I have following content in my view file (.cshtml)
function FillFeedCharges()
{
var link;
var idModel = $("#sGroup_cd").val();
if (idModel != "") {
$.getJSON("@Url.Content("~/GroupMast/List")", { sGroup_cd: idModel, sCompany_cd :"01"},
function (data) {
var header = '<tr><td> ' + '</td>' + '<td> </td>' + '<td>Description' + '</td>' + '<td> </td>' + '<td>' + 'DateStarted' + '</td>'+ '<td> </td>' +'<td>' + 'AvgCalories' + '</td>' + '<td> </td>' +'<td>' + 'Pounds' + '</td>' + '<td> </td>' +'<td>' + 'Cost' + '</td>' +'</tr>' ;
$('#users table').append(header);
$.each(data, function (key, val) {
var user = '<tr><td>'+'<a onclick='+'javascript:CallEditDetail()'+'>Click here</a>' +'</td>' + '<td> </td>' + '<td>' + val.Description + '</td>' + '<td> </td>' + '<td>' + val.DateStarted + '</td>'+ '<td> </td>' +'<td>' + val.AvgCalories + '</td>' + '<td> </td>' +'<td>' + val.Pounds + '</td>' + '<td> </td>' +'<td>' + val.Cost + '</td>' +'</tr>';
$('#users table').append(user);
});
});
when i Called 'CallEditDetail' function in $(document).ready(function () it is not callled and give error as 'CallEditDetail not declared' and if i called from outside the $(document).ready(function () it is called. Please help me