我收到了错误 “415不支持的媒体类型”。我已经尝试过提供的解决方案。但我的问题没有解决。
这是我的代码,用于在jqgrid中动态接收jason数据
jQuery(grid_selector).jqGrid({
contentType: "application/json",
datatype: "json",
height: 250,
colNames:['Workbook Name','Superior','Hierarchy','Usage', 'Created', 'Created by'],
colModel:[
{name:'name',index:'name', width:90,editable: true,formatter:function(rowId, val, rawObject, cm, rdata) {
return "<a href='1.1.1 Edit Workbook (Name).html' style='height:25px;width:120px;' type='button' >"+rawObject.name+"</a>";
},unformat:undoaddLink,search: true},
{name:'recordType',index:'recordType', width:90,formatter:function(rowId, val, rawObject, cm, rdata) {
return "<a href='#' type='button' >"+rawObject.recordType+"</a>";
},editable: true,editoptions: { readonly: 'readonly' },unformat:undoaddLinkparent,search: true},
{name:'hierarchy',index:'hierarchy', width:150,editoptions: { readonly: 'readonly' },formatter: setVal,search: true,unformat:undohierarchy},
{name:'usage',index:'usage', width:90,editable: true,editoptions: { readonly: 'readonly' },search: true,formatter:ChangeVal},
{name:'created',index:'created', width:70,editable: true, editoptions: { readonly: 'readonly' },search: true},
{name:'createdBy',index:'createdBy', width:90,editable: true,editoptions: { readonly: 'readonly' },search: true}
],
viewrecords : true,
rowNum:10,
rowList:[10,20,30],
pager : pager_selector,
altRows: true,
'cellEdit': true,
'cellsubmit' : 'clientArray',
editurl: 'clientArray',
multiselect: true,
multiboxonly: true,
sortable: true,
gridComplete: function() {
$("tr").not(':first').hover(
function () {
$(this).css("background","#CCCCFF");
},
function () {
$(this).css("background","");
}
);
},
loadComplete : function() {
var table = this;
setTimeout(function(){
styleCheckbox(table);
updateActionIcons(table);
updatePagerIcons(table);
enableTooltips(table);
}, 0);
},
});
我正在localhost中获取jason数据。但是在服务器中我收到了错误。 提前致谢