layui table请求数据时出现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!

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值