enter image description hereI have an HTML file named as index.html
.
The file contains a JSON array data as added below.
I want to display this array using div tag, The HTML code is given below :
Code
//node js code
res.sendFile(__dirname+'/index.html',{data:JSON.stringify(data)});
//html code
<% var d = JSON.parse(data); for (var i= 0; i < JSON.parse(data)[0].length; i++) { %>
<div class="col-md-12 mt-3 border-bottom p-2 chat-select ">
<div class="row">
<div class="user-chat-img">
<img src="img/user.jpg">
</div>
<div class="">
<p class="font-weight-bold"><%= d[0][i].name %></p>
<span>Hello I am DK Singha </span>
</div>
</div>
</div>
<% } %>
Please suggest me how to resolve this problem.