#fabric-chaincode #fabric-chaincode
Andrew Coleman
If you want to display the results of ledger queries in the browser, you'll need to create a backend component that interacts with Fabric. I suggest studying the REST API sample (https://github.com/hyperledger/fabric-samples/tree/main/asset-transfer-basic/rest-api-typescript) for guidance on this.
|
|
pham.qtpham@...
Hi,
How can I query data in blockchain and populate the data in a poplist? E.g. I already have a function allowed me to bind select element with JSON array below: function populateSelect() { // THE JSON ARRAY. var equipments = [ { "equipmentNumber": "3934643b-fa03-44ea-ba94-27e7248d265e", "equipmentName": "e360-Ventilator", "equipmentCost": "1000.00" }, { "equipmentNumber": "e024fc36-e41d-49f0-b40d-e4094b9aa40e", "equipmentName": "SPo2 Oximeter", "equipmentCost": "100.00"
}, { "equipmentNumber": "65b72408-41d3-4539-9efb-08edfbabaced", "equipmentName": "Blood Pressure Monitor", "equipmentCost": "300.00" }, ];
var ele = document.getElementById('orderItem'); for (var i = 0; i < equipments.length; i++) { // POPULATE SELECT ELEMENT WITH JSON. ele.innerHTML = ele.innerHTML + '<option value="' + equipments[i]['equipmentNumber'] + '">' + equipments[i]['equipmentName'] + ", Unit Cost:" + equipments[i]['equipmentCost'] + '</option>'; } } Now instead of static data in JSON array, I want to use dynamic data obtained from a blockchain's query. How can I achieve this? Trung
|
|