In my project I want the user to select a radio button, then based on the value of the radio button I want to display a unique page. I have to use an ejs template and I don't understand how to pass the value of the button to the ejs template.
<input name="imagePick" value="1" type="radio" id="one">
<label for="one">
<img src="images/aries.png" alt="aries" height="150" width="auto">
</label>
<input name="imagePick" value="2" type="radio" id="two">
<label for="two">
<img src="images/taurus.png" alt="taurus" height="150" width="auto">
</label>
$("input[name='imagePick']").on("change", function() {
var sign = $('input[name="imagePick"]:checked').val();
console.log("the sign is: " + sign);
});
var theSign = sign;
res.render('template.ejs', {theSign : theSign});
</head>
<body>
<% for (var i = 0; i < allTheData.length; i++) { %>
<h1>Hi <span id="first"><%=allTheData[i].first%></span><br/><br/></h1>
<% } %>
<h1> sign: <span id="sign"><%=theSign%></span></h1><br/>
<h2> what a great webapp </h2>
</body>
</html>