Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

165
Views
my redirect doesn't work though I have the correct syntax

I have the following code :

app.get('/decl_param', async (req, res) => {
  var gui = await guiText("declension", lang);
  var msg = await messageText("declension", lang);
  console.log("msg", msg);
  res.render("decl_param", { gui: gui, msg: msg });
})
app.get('/decl_quizz', async (req, res) => {
  var gui = await guiText("index", lang);
  var msg = await messageText("declension", lang)
  console.log(" decl_quizz requested");;
  res.render('decl_quizz',{gui:gui,msg:msg} );
})
app.post('/decl_param', async (req, res) => {
  console.log("post obtained /decl_param");
  //let question = req.body; // JavaScript object containing the parse JSON
  //let answer = await makeDeclAnswer(question, lang);
  //console.log("question", answer);
  //res.json(answer);
  res.redirect(301,'/decl_quizz');
})

Console output :

 post obtained /decl_param  
 decl_quizz requested

When I click in a button in the page 'decl_param', a post message is sent, a redirection is requested, the page '/decl_quizz' seems to be generated but the browser still stays at '/decl_param' and '/decl_quizz' is not displayed.

Directly requesting /decl_quizz in the address bar does work correctly. What is wrong in my redirection ?

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!