I wanna send the value from controller to ejs file without reloading page when I summit input in ejs. This is code in ejs file.
<html>
<p class="topicCard3">History Of PM2.5 Values In <%= country %></p>
<form method="POST" action="/historyPM2.5">
<input class="inputCountry" name='country' placeholder="enter country name">
<button class="submitButton">SUBMIT</button>
</form>
<p>
<html>
and this is code in controller.js
exports.historyPm = function(req,res) {
country = req.body.country
res.render('home',{
'country': country
})
}
I need to process something in controller then send result to ejs for showing. Now, I send the value input from ejs to controller and then click summit button the page will reload. Thank for helping.