title: How to pass Data from express to .ejs file while redirecting in node.js
body: <p>I have on login form in login.ejs file when i click on submit after filling information i am redirecting to the page if detail are correct otherwise i want to show something in .ejs that password is wrong.Below are the detail</p>
  
  <p>Here is my app.js file code- Here i am sending one json and hiding that invalid password in .ejs file</p>
  
  <pre><code> app.get('/', function (req, res) {
  
       res.render("login",{Error:"none"});
  
  });
  
  app.post('/login', function (req, res) {
  
      var username = req.body.username;
      var password = req.body.password;
       //Here will be my code to check detail wrong or right
       res.redirect('/',{Error:'block'});
  }
  </code></pre>
  
  <p>Here is my login.ejs file</p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html lang="en"&gt;
  &lt;head&gt;
      &lt;meta charset="utf-8"&gt;
      &lt;title&gt;&lt;/title&gt;
      &lt;link rel="stylesheet" href="css/style.css" type="text/css" /&gt;
      &lt;link rel="stylesheet" href="css/font.css" type="text/css" /&gt;
      &lt;meta name="viewport" content="width=device-width, initial-scale=1.0"&gt;
  
  &lt;/head&gt;
  
  &lt;body&gt;
      &lt;div class="Error" id="error" style="display:&lt;%=Error%&gt;;"&gt;Invalid email/phone or password&lt;/div&gt;
      &lt;div class="Body"&gt;
          &lt;form class="LogBox" action="/login" method="post"&gt;
              &lt;div class="Head"&gt;Log In&lt;/div&gt;
                  &lt;input type="text" placeholder="Email or Phone" class="inputfrontbutton" name="username"&gt;
                  &lt;input type="password" placeholder="Password"  class="inputfrontbutton" name="password"&gt;
                  &lt;input type="submit" value="Log In" class="frontsubmit"&gt;
          &lt;/form&gt;
      &lt;/div&gt;
  &lt;/body&gt;
  
  &lt;/html&gt;
  </code></pre>
  
  <p>But I am unable to send json data in redirect.Is there any way i can do this?</p>