Javascript 通过axios发送请求,然后动态构建html,或者通过nodejs应用程序中的res.render方法,哪个方法更有效
下面是我用来在页面上显示数据的代码,html是动态创建的,另一种方法是我查询数据库并使用res.render方法来呈现它,应该使用哪种方法Javascript 通过axios发送请求,然后动态构建html,或者通过nodejs应用程序中的res.render方法,哪个方法更有效,javascript,node.js,web,Javascript,Node.js,Web,下面是我用来在页面上显示数据的代码,html是动态创建的,另一种方法是我查询数据库并使用res.render方法来呈现它,应该使用哪种方法 if (tBody) { return ( `<tr class="tr1"> <th class="th1"> Category Name </th> <th class="th1">De
if (tBody) {
return (
`<tr class="tr1">
<th class="th1"> Category Name </th>
<th class="th1">Delete </th>
</tr>` +
getdata.data
.map(function (wizard) {
return `<tr class="td1"> <td class="th1"> ${wizard.categoryName}</td>
<td class="td1"><a class="delClass" onclick="removeCat(this)" data-remove="${wizard._id}">Delete</a></td>
</tr>`;
})
.join('')
);
if(t车身){
返回(
`
类别名称
删除
` +
getdata.data
.map(函数(向导){
返回`${wizard.categoryName}
删除
`;
})
.加入(“”)
);