这是我的Ajax通话
let options = {};
options.chaincodeId = "instrumentcc";
options.methodToBeCalled = "queryInstrument";
let arguments = {};
arguments.arg1 = '{"selector":{"Status":"open"}}';
options.dataArguments = arguments;
console.log("options ", options)
$.ajax({
url: "http://localhost:3000/postSender",
datatype: "JSON",
type: "Post",
data: options,
success: function (data) {
console.log("data ", data)
data1 = JSON.parse(data);
console.log("data parse", data1)
}
});
响应数据为
[{"Key":"1088b94e1f5353484ff9609cbeef8cd36679e1af145e273140c65d96a7e24b07",
"Record":{
"docType":"InstruObject",
"RefNo":"I001",
"Date":"2018-11-15T00:00:00Z",
"SellerID":"B002",
"BuyerID":"B001",
"Amount":"1000",
"Status":"open",
"DueDate":"2019-11-16T00:00:00Z",
"ProgramID":"1prg",
"PPRID":"1ppr",
"UploadBatchNo":"323453454121",
"ValueDate":"2019-01-04T12:43:59Z"
}
}]
我需要从RefNo
获得Record
。
我使用了data1.Record.RefNo
,它显示data1.Record是未定义的。
然后如何访问RefNo
?
预先感谢。
答案 0 :(得分:0)
使用console.log(data [0] .Record.RefNo);没有JSON.parse。