我已使用MVC 4.0中的$ .get方法将序列化对象作为参数传递
$('#btnGenerateReport').click(function () {
// get filter data
var reportType = $('input[name=rtype]:radio:checked').val();
var towerlist = '',
streamList = '',
resourceList = '',
projectList = '';
$("#selectTower").multiselect("getChecked").each(function (index, object) {
towerlist = towerlist + $(object).val() + ','
});
var o = new Object();
o.TowerId = towerlist;
$.get('@Url.Action("Resource", "Report")', {
'filterList': JSON.stringify(o)
}, function (data) {
$('#report').replaceWith(data);
$('div.well').hide();
});
});
但它始终在控制器方法
中返回filterList null public ActionResult Resource(ResourceReport filterList)
{
var t = filterList.TowerId;
var report = resourceReportService.GetResourceReport();
return View("ResourceReport",report);
}
我已添加using System.Web.Script.Serialization;
命名空间