我刚刚建立了一个具有nodejs后端和react前端的应用程序。在nodejs中,我调用API并收到响应res
。现在,使用此信息,我想填充一个表,以便我执行类似的操作:
var mex = require('mex');
mex.fetchPricingBucket("1h", "XBT", 10, "2019-01-26", "2019-01-27",
function(res, err){
document.getElementById("btc_total_holdings").innerHTML = data.userId
const table = document.getElementById('historical_table_data');
//
const row = document.createElement('tr');
const value1 = document.createElement('td');
const value1a = document.createElement('div');
value1a.textContent = data.userId;
const value1b = document.createElement('div');
value1b.setAttribute('class', 'small text-muted');
value1b.textContent = "Registered: Jan 1, 2019";
const value2 = document.createElement('td');
value2.textContent = data.userId;
table.appendChild(row);
row.appendChild(value1);
value1.appendChild(value1a);
value1.appendChild(value1b);
row.appendChild(value2);
console.log(res);
但这看起来不正确,也无法编译,那么进行此操作的最佳方法是什么?