Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6986235
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T18:46:59+00:00 2026-05-27T18:46:59+00:00

I use node.js – Express. I have a page (index.html) and html div (id

  • 0

I use node.js – Express. I have a page (index.html) and html div (id = box) and input (id = inputUser). I want to express through insert (when the page loads) text into the div and input.

Thanks for the advice!

Client:

<form method="post" action="/">
    <input type="text" name="inputUser" id="inputUser" />
    <div id="box"></div>
</form>

Server:

app.get('/', function (req, res) {
  res.render('index.html', { layout: false });
});

app.post('/', function(req, res){
});
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T18:46:59+00:00Added an answer on May 27, 2026 at 6:46 pm

    From what I see in your code snippet above, you are probably using EJS as the view engine. You can pass the variables to the view just like you pass the false option for layout.

    Server

    app.get('/', function (req, res) {
      functionToLoadDataFromDatabase(function(divData, userData) {
        // this is the callback
        res.render('index.html', { 
          layout: false,
          divData: divData,
          userData: userData
        });
      });
    });
    

    Client-side

    <form method="post" action="/">
      <input type="text" name="inputUser" id="inputUser" value="<%= userData %>" />
      <div id="box"><%- divData %></div>
    </form>
    

    From the EJS documentation:

    Escapes html by default with <%= code %>   
    Unescaped buffering with <%- code %>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an application where I want to use node.js and now.js to share
I use node.js and express. When I press the button (btnSend), I want to
I want to use LabVIEW's Call Library Function Node to access a DLL function,
I need to insert the comment form directly to the node template (I use
I would like to use MySQL with Node.js on Windows. I have tried to
I have a Drupal 6 web site and would like to use a node
In my HTML I have something like this <input type=button value=Delete onclick=delete(this);/> and in
I want to use Node.js scripts in my C/C++ applications. Some people suggested me
So, I want to use node.js and http request pipelining, but I want to
I use node.js as a client that makes some http requests. I want to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.