我从控制器返回了这个 Json:
public ActionResult VerifyApp(string recurrence)
{
List<foo> item = schedulingProxy.CheckApp(recurrence);
return Json(item, JsonRequestBehavior.AllowGet);
}
我认为这张表是:
<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>
我还在视图顶部添加了这个:
@{
var conflictList =new List<Mavi.Domain.Model.contactThread>();
}
我在我的 Jquery 中有这个 Axaj 调用:
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>
}
});
}
如何将返回的 JSon 对象中的值添加到冲突列表中?或者更好..我怎样才能填充我的表?