action
var result = new List<MyClass>();
MyClass m1 = new MyClass();
MyClass m2 = new MyClass();
result.Add(m1);
result.Add(m2);
return Json(result);
js
$.post("/Tradeshow/AddTradeShowDetail", {
startdate: $('#cstartdate').val(),
enddate: $('#cenddate').val(),
location: $('#clocation').val(),
speakerid: $('#TradeshowSpeakers').val(),
isnonspeaker: value
}, function(data) {
if (data && data.d && data.d.length > 0) {
var rows = $.map(data.d,function(item) {
return ('<tr><td>' + item.Name + '</td></tr>');
}).join('');
$('tbody').html(rows);
}
});
Check if the list is in data.d
when it comes back. If not, just process data