layui table请求数据时出现415错误解决办法

来源:互联网 发布:硬盘烧坏数据能恢复吗 编辑:程序博客网 时间:2024/05/20 22:40
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!

阅读全文
0 0