当我在浏览器上使用localhost:8080/SpringServiceJsonSample/rest/service/user/
时,我返回json类型的所有数据,但是当我在jQuery网格数据中使用此url数据时未加载,我也使用了调试器,但没有发现错误。Json阅读器问题
jQuery("#grid").jqGrid({
// url: '/Home/SampleGridData/',
url: '/SpringServiceJsonSample/rest/service/user/',
datatype: 'json',
mtype: 'GET',
contentType: "application/json" ,
colNames: ['First Name', 'lastName'],
colModel: [
{ name: 'firstName', index: 'name', width: 60, align: 'center', editable: true, editrules: { edithidden: false} },
{ name: 'lastName', index: 'lastName', width: 200, align: 'center', sortable: true, editable: true, edittype: 'text', editrules: { required: true, email: true} },
],
pager: jQuery('#pager'),
rowNum: 10,
rowList: [5, 10, 20, 50],
sortorder: "asc",
viewrecords: true,
caption: 'JqGrid Sample',
jsonReader: {
repeatitems: true,
id: "0",
cell: "cell",
rows : "details",
page : "pageno"
}
});
});
的json价值回归这样的: - [{ “ID”:1, “名字”: “与Pradeep”, “姓氏”: “与Pradeep”, “电子邮件”:空},{ “ID”:2, “名字”: “特湖”, “姓氏”: “特湖”, “电子邮件”:空}]
你是否能够在浏览器的网络部分看到请求到'localhost:8080/SpringServiceJsonSample/rest/service/user /'URL?你会得到200个响应码吗? – vijayP
@ vijayP,老兄没有 –
这意味着这个调用根本不会被调用。请检查网络部分,看看为什么'/ SpringServiceJsonSample/rest/service/user /'变得最终的URL已经变成# – vijayP