I am trying to redirect option.ejs file to rds.ejs file based on select option from dropdown list, but I got "Cannot GET /SDP-RDS".
This is my js code of option.ejs:
function enableProgram(option) {
console.log(option.value);
if (option.value == 1) {
document.getElementById('Comp').classList.remove('d-none');
document.getElementById('SDP').classList.add('d-none');
}
if (option.value == 0) {
document.getElementById('SDP').classList.remove('d-none');
document.getElementById('Comp').classList.add('d-none');
}
};
function getval() {
var sel2 = document.getElementById('SDP');
if (sel2.value == "STORGE") {
window.location.href = "/SDP-RDS"
}
In app.js I wrote these lines:
script.use(express.static(path.join('../public')));
app.get('/SDP-RDS', (req, res) => {
res.render('pages/SDP-RDS');
});