I have this Json returned from controller :
public ActionResult VerifyApp(string recurrence)
{
List<foo> item = schedulingProxy.CheckApp(recurrence);
return Json(item, JsonRequestBehavior.AllowGet);
}
And I have this table in my view:
<div class="table">
<table id="thids" class="bg">
<thead>
<tr>
<th>
Date
</th>
<th>
Time
</th>
<th>
Slot
</th>
<th>
</th>
</tr>
</thead>
<tbody>
@foreach (var item in conflictList)
{
<tr id="@item.ID">
<td>
@Html.DisplayFor(modelItem => item.ResourceFName)
</td>
<td>
@Html.DisplayFor(modelItem => item.ResourceLName)
</td>
<td>
@Html.DisplayFor(modelItem => item.ResourceSlot)
</td>
<td>
@Html.DisplayFor(modelItem => item.reason)
</td>
</tr>
}
</tbody>
</table>
also i have added in the top of the view this :
@{
var conflictList =new List<Mavi.Domain.Model.contactThread>();
}
And I have this Axaj call in my Jquery :
function ChkAvailable() {
pairString = pairString + newObj.ToString() + "]";
var requrl = '@Url.Action("VerifyAppointment", "Scheduling", null, Request.Url.Scheme, null)';
$.ajax({
type: "POST",
url: requrl,
data: { recurrence: pairString },
success: function (data) {
//returned List<foo>
}
});
}
How can i add the values from my returned JSon Object into the conflictList ?? Or better yet .. How can i populate my Table ?