我正在将 jquery getJSON 与 asp.net mvc 控制器一起使用......我无法让它工作......
public JsonResult GetMaterials(int currentPage,int pageSize)
{
var materials = consRepository.FindAllMaterials().AsQueryable();
var results = new PagedList<MaterialsObj>(materials, currentPage-1, pageSize);
return Json(results);
}
我打电话给这个,
$.getJSON('Materials/GetMaterials', "{'currentPage':1,'pageSize':5}",
function(data) {
});
这个电话似乎不起作用....
当通过萤火虫检查时,我发现了这个,
The parameters dictionary contains a null entry for parameter
'currentPage' of non-nullable type 'System.Int32' for method
'System.Web.Mvc.JsonResult GetMaterials(Int32, Int32)' in
'CrMVC.Controllers.MaterialsController'. To make a parameter optional its type
should be either a reference type or a Nullable type.<br>
Parameter name: parameters