【jqGrid】中文参数乱码

版权声明:本文为博主原创文章,未经博主允许不得转载。QQ讨论群:271934368 https://blog.csdn.net/huangjp_hz/article/details/78751647

小记

在使用jqGrid时,当查询参数输入中文时,查询不到数据,发现是传递到后台时乱码了,这时候只要在jqGrid初始化参数中,加入mtype:”post”即可,代码如下:

    $("#id).jqGrid({
        url: "",
        datatype: "json",
        postData: "",
        page : 1,
        mtype:"post",
        height: 305,
        multiselect: true,
        colNames:[],
        colModel:[],
        rownumbers: true,
        viewrecords : true,
        rowNum:10,
        rowList:[10,20,30],
        pager : "#pageId",
        altRows: true,
        autowidth: true,
        loadComplete : function() {
            var table = this;
            setTimeout(function () {
                updatePagerIcons(table);
                enableTooltips(table);
            }, 0);
        }
    });

猜你喜欢

转载自blog.csdn.net/huangjp_hz/article/details/78751647