首页 > 应用开发 > > .net core使用layui分页查询问题
前端代码:
layui.use("table", function () {
var table = layui.table;
table.render({
elem: '#user'
, height: 312
, url: '/user/UserList' //数据接口
, page: true //开启分页
, toolbar: '#toolbarNote'
, contentType: 'application/x-www-form-urlencoded'
, method:"get"
, parseData: function (res) {
}
, cols: [[ //表头
{ field: 'Account', title: '账号', width: 120, fixed: 'left' }
, { field: 'Username', title: '用户名', width:120 }
, { field: 'Sex', title: '性别', width: 120 }
, { field: 'Email', title: '邮箱', width:120, sort: true }
, { field: 'Permission', title: '权限', width: 120 }
]]
})
});
后台控制器:
public IActionResult UserList(int page,int limit)
{
string pageIndex =Request.Form["page"].ToString();
return View();
}
我F12能看到参数,但是调试的时候两个参数一直为0,并且使用Request一直提示Incorrect Content-Type的错误。
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/1729/viewspace-3128572/ ,如需转载,请注明出处,否则将追究法律责任。