这是有效的 jquery getJSON 调用吗?
我正在使用 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) {
});
此调用似乎不起作用...
当通过 firebug 检查时我发现这,
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
I am using jquery getJSON with asp.net mvc controller... I cant able to get it work....
public JsonResult GetMaterials(int currentPage,int pageSize)
{
var materials = consRepository.FindAllMaterials().AsQueryable();
var results = new PagedList<MaterialsObj>(materials, currentPage-1, pageSize);
return Json(results);
}
and i am calling this with,
$.getJSON('Materials/GetMaterials', "{'currentPage':1,'pageSize':5}",
function(data) {
});
This call doesn't seem to work....
when inspected through firebug i found this,
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
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
通常,
data
应该是一个对象:Typically,
data
should be an object: