如果我将 mType 设置为 POST,为什么我的网格使用 GET?
Why is my grid using GET if I set mType to POST?
我正在使用 jqGrid。这是我的网格精简代码:
$("#users").jqGrid({
datatype: 'json',
url: 'AjaxProxy.cfm',
mType: 'POST',
gridview: true,
colModel: [
{name: 'lastname', label: 'Last Name'},
{name: 'firstname', label: 'First Name'},
... more columns ...
],
height:'auto',
autowidth:true,
caption:'Users',
rowNum:20,
rowList:[10,20,50],
sortorder:'asc',
sortname: 'lastname',
ignoreCase: true, // case-insensitive filtering
pager: '#pager',
jsonReader: {
root: "ROWS", //our data
page: "PAGE", //current page
total: "TOTAL", //total pages
records:"RECORDS", //total records
cell: "", //not used
id: "0" //will default first column as ID
},
postData: postData
});
我最近在mType: 'POST'
中添加了。但是,当我在 AjaxProxy.cfm 文件中输出 request_method 时,它表明它正在使用 GET,并且所有网格参数都在 URL 中传递,而不是作为 POST值。 Firebug 和 Chrome 开发人员工具还表明它正在使用 GET。为什么还在用GET?
存在没有mType
选项,只有mtype
。 JavaScript 中的所有名称都区分大小写。
的用法
mtype: 'POST'
应该可以解决您的问题。
我正在使用 jqGrid。这是我的网格精简代码:
$("#users").jqGrid({
datatype: 'json',
url: 'AjaxProxy.cfm',
mType: 'POST',
gridview: true,
colModel: [
{name: 'lastname', label: 'Last Name'},
{name: 'firstname', label: 'First Name'},
... more columns ...
],
height:'auto',
autowidth:true,
caption:'Users',
rowNum:20,
rowList:[10,20,50],
sortorder:'asc',
sortname: 'lastname',
ignoreCase: true, // case-insensitive filtering
pager: '#pager',
jsonReader: {
root: "ROWS", //our data
page: "PAGE", //current page
total: "TOTAL", //total pages
records:"RECORDS", //total records
cell: "", //not used
id: "0" //will default first column as ID
},
postData: postData
});
我最近在mType: 'POST'
中添加了。但是,当我在 AjaxProxy.cfm 文件中输出 request_method 时,它表明它正在使用 GET,并且所有网格参数都在 URL 中传递,而不是作为 POST值。 Firebug 和 Chrome 开发人员工具还表明它正在使用 GET。为什么还在用GET?
存在没有mType
选项,只有mtype
。 JavaScript 中的所有名称都区分大小写。
mtype: 'POST'
应该可以解决您的问题。