Your question is not so clear but I will try to give you some hints:
1.If you want from your code to pass data to your page you should do like in the next example:
var result = new
{
total = (int)Math.Ceiling((double)count / grid.PageSize),
page = grid.PageIndex,
records = count,
rows = (from host in data
select new
{
ID = host.ID,
VisitorName = GetVisitorNameForBinding(host),
StartDate = host.StartDate.ToString(),
EndDate = host.EndDate.ToString(),
WasTimeOut = (host.WasTimeOut ?? false)
}).ToArray()
};
return Json(result, JsonRequestBehavior.AllowGet);
2.If you want from your page to pass data to your page and also to update the control from UI with the result from your call, you should use jQuery like in the next example:
function computeWithJson(action, itemComment1, itemAmount1, itemLength1, itemWidth1, itemThickness1) {
$.ajax({
type: "POST",
url: action,
data: { itemComment: itemComment1, itemAmount: itemAmount1, itemLength: itemLength1, itemWidth: itemWidth1, itemThickness: itemThickness1 },
success: function (resultData) {
var quantity = resultData.result;
$("#computedQuantity").val(quantity)
},
dataType: "json"
});