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 7068533
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T05:20:08+00:00 2026-05-28T05:20:08+00:00

I have a web app were the entire layout remains constant except for one

  • 0

I have a web app were the entire layout remains constant except for one <div>. Currently, I’m just using routes to handle links and it seems like quite a waste to reload the rest of the layout.ejs file where the only thing I wish to change is my <div>.

What would I have to change in my layout.ejs file? Here is my current file:

<!DOCTYPE html>
<html lan="en">
  <head>
    <title><%= title %></title>
    <link rel="stylesheet" href="/stylesheets/reset.css">
    <link rel='stylesheet' href='/stylesheets/style.css' />
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.5.2/jquery.min.js"></script>
    <script src="/nowjs/now.js"></script>
    <script src="/javascripts/chat.js"></script>
  </head>
  <body>
    <div id="wrapper">
        <div id="header">
        </div>
        <div id="chat">
            <input type="text" id="text-input">
            <input type="button" value="Send" id="send-button">
        </div>
        <div id="content">
            <%- body %>
        </div>
        <div id="rooms">
        </div>
        <div id="footer">
            <div id="footer_links">
                <a href="/">Home</a> | <a href="/about">About</a> | <a href="/contact">Contact</a>
            </div>
        </div>
    </div>
  </body>
</html>

I was thinking about using AJAX to use this, but I’ve heard some good things about using partial views. I’m just not sure at all about how to set this up. Also, I’ve heard that it’s possible to use WebSockets with partial views instead of AJAX. Is this a good idea, or even possible?

Sorry this may be straightforward. I’m having a difficult time with the documentation.

Thanks!

  • 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-28T05:20:09+00:00Added an answer on May 28, 2026 at 5:20 am

    I just worked it out.


    You can call `partial(filename)` in the view to load the partial. say we use EJS, and there is three files in `views/`:

    1. layout.ejs
    2. index.ejs
    3. header.ejs

    and the content of index.ejs is :

    then, start the server, browser it, you will see `header.ejs` is loaded to `index.ejs`.

    !!! UPDATE

    In the express version >=3.0, there is no partial() any more. But we can use <% include xxx.file %>, or just use another module: “express-partials”. Please search it on Github.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a web app which connects to a server using a TCP connection
OK, So I am creating a entire web app using AJAX with some local
In my mobile web app, I have this //Prevent scrolling in entire document document.ontouchmove
I am working on a web app using C# and asp.net I have been
We're currently developing a J2EE web app using JPA as our data access layer.
I currently have a web app that uses ActiveX / JScript to read files
I have a portfolio web app that is run on Sinatra using pjax .
I have a small web app I wrote that has a Dijit.layout.BorderContainer nested within
I have just joined a team working on an existing Java web app. I
need ask you about some help. I have web app running in Net 2.0.

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.