1. 程式人生 > >【jqGrid】中文引數亂碼

【jqGrid】中文引數亂碼

小記

在使用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); } });