アクセスできないサーバーからこの種の JSON を読み取るのに問題があるため、JSON を操作できません。
{
"API_ICDFactory": {
"API_getDataSample": {
"key_0": {
"dateTransaction": "1379454296",
"dateBilling": "1387320296",
"units": "181",
"priceUnit": "25.12",
"amount": "4546.72",
"company": "Juan Vivas Taller",
"productRef": "CAR",
"productDesc": "Detergente especial antiestático"
},
"key_1": {
"dateTransaction": "1377421074",
"dateBilling": "1385373474",
"units": "137",
"priceUnit": "8.99",
"amount": "1231.63",
"company": "Autos Caceres 2000",
"productRef": "BRICAR",
"productDesc": "Cera hidrofugante para túneles de lavado"
},
"status": "success"
}
}
}
この Json から要素を取得する方法がまったくわかりません。誰かが私を助けることができれば。
jqGrid ドキュメントからこのコードを操作しようとしていますが、結果が得られません。
jQuery(document).ready(function(){
jQuery("#grid").jqGrid({
url: "url...",
datatype: "json",
mtype: "GET",
colNames: ['Fecha Trans','Fecha Pago', 'Cliente'],
colModel: [
{name:'dateTransaction',index:'dateTransaction', width:100,editable:true},
{name:'dateBilling',index:'dateBilling', width:100,editable:true},
{name:'company',index:'company', width:100,editable:true}
],
jsonReader: {
repeatitems:false
},
rowNum:10,
rowList:[10,20,30],
pager: jQuery('#pager'),
sortname: 'name',
viewrecords: true,
sortorder: 'asc',
caption:'Title',
editurl:'url...'
}).navGrid('#pager');
});
誰かがこの JSON の正しい構文を教えてくれれば、あとは私ができるでしょう。
ありがとう!