I'm now learning Node.js and creating a web application, but don't know how to render twice on the same .ejs file.
So in the following .ejs file:
<table>
<% rows.forEach(function(ind){ %>
/* map each value of each field to table */
<% }) %>
</table>
<table>
<% rows2.forEach(function(ind){ %>
/* map each value of each field to table */
<% }) %>
</table>
And I want to execute two separate queries and render them to the same .ejs file, but when I tried to, I can't since at the time when I tried to run first query and render it to the above .ejs file I don't have the result from second query which spits out values for the second table (i.e. row2 data). How can I deal with it? Or do I have to make two separate .ejs file and do rendering twice in a nested form? I like to avoid a nested file as best as possible, so if there were any solutions please tell me...
Thanks.