CODE:
login.ejs
<script>
req.flash('success_msg', 'You have logged in');
</script>
header.ejs
<div class = "alertMessage">
<% if (success_msg != false){ %>
<span class="alert alert-success containerMargins">
<%= success_msg %>
</span>
<% } %>
<% if (error_msg != false){ %>
<span class="alert alert-danger containerMargins">
<%= error_msg %>
</span>
<% } %>
</div>
SITUATION:
This has nothing to do with using flash on the server-side and displaying the message on the client-side: it already works perfectly for me.
This has to do with calling flash from the client or replicating the same behaviour from the client with some other library.
QUESTION:
The code I showed of course does not work on the client-side, what can I do to replicate that behaviour on the client-side ?