核心提示:layuitable请求数据时出现415错误问题及解决办法table.render({height:400,elem: #userTable,cols: [[{field: myIndex,title...
layuitable请求数据时出现415错误问题及解决办法
table.render({ height:400 ,elem: '#userTable' ,cols: [[ {field: 'myIndex',title: '序号',width: 60,fixed: true} ,{field: 'realName', title: '真实姓名', width: 100} ,{field: 'username', title: '用户名', width: 160} ,{field: 'phoneNum', title: '手机号', width: 60} ,{field: 'bankAccount', title: '银行卡号', width: 60} ,{field: 'purchasedGoods', title: '报单商品', width: 100} ,{field: 'receiverName', title: '收货人', width: 100} ,{field: 'deliveryAddress', title: '收货地址', width: 60} ,{field: 'creatorId', title: '报单人', width: 100} ,{field: 'auditTime', title: '审核时间', width: 100,sort: true} ,{field: 'auditState', title: '审核状态', width: 100,sort: true} ,{field: 'diagnosisDate', title: '发货状态', width: 100,sort: true} ,{fixed: 'right', width:190, align:'center', toolbar: '#barContagion'} ]] ,id: 'userEvent' ,url: '/tourist-portal/register/findList' ,where: qvo ,method: 'post' ,skin: 'row' //表格风格 ,even: true ,page: true //是否显示分页 ,limits: [10,20,30,40,50,100,500,1000] ,limit: 10 //每页默认显示的数量 });
出现415 unsupported media type
解决办法:
在table.js源码中修改ajax的contentType,
添加contentType: "application/json",
dataType: "json",
problem solved!