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

  • Home
  • SEARCH
  • 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 8823009
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T06:14:52+00:00 2026-06-14T06:14:52+00:00

First off, this site has helped me immensely through some school projects, and I

  • 0

First off, this site has helped me immensely through some school projects, and I hope my question is specific enough for some answers.

What I’d like to do is change the content of a div on my page (lets call it ‘#content’), while also somehow allowing for direct access to the various “pages” that would be created by changing the div’s content.

For example, lets say that “foo.com/home” is to be the home page. The ‘#content’ div would need to get filled with the code for the home page, while the other elements around it remain static (such as the header, footer, and navigation divs). Likewise, “foo.com/forum” would fill ‘#content’ with the code for the forum, and other pages would do the same.

Currently, I’m simply checking the hash at the end of the URL, and then using jQuery’s load() method to load my various code into ‘#content.’ However, in addition to the fact that using the hash for navigation seems finicky on mobile browsers, it also just feels wrong to me.

I was thinking of using PHP, and then just using PHP includes to change what code is loaded into ‘#content’ based on the URL. For example, “foo.com/page=forum” would fetch a page that is the same (layout wise) as the home page (header/footer, navigation, etc.), but would just include a different file for ‘#content.’ However, this will reload the ENTIRE page, and not just ‘#content’ right?

Ideally, I’d like to use some sort of AJAX call to reload just the ‘#content’ div, but, other than editing the URL hash, I’m not sure how to do this while also allowing for bookmarks and such. I’d like users to just be able to go to “foo.com/home” or “foo.com/forum” and end up with the “template page” (header/footer, nav) filled in with the correct content.

Again, sorry if this is a poorly worded question. I’ve done some research, but can’t seem to work out the best way to get this done. Thanks in advance — any tips are appreciated.

  • 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-06-14T06:14:54+00:00Added an answer on June 14, 2026 at 6:14 am

    Check this example code:

             var xmlhttp;
             if (window.XMLHttpRequest)
                {
               xmlhttp=new XMLHttpRequest();
                }
             else
                {
               xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
                }
             xmlhttp.onreadystatechange=function()
                {
               if (xmlhttp.readyState==4 && xmlhttp.status==200)
                  {
                 document.getElementById("content").innerHTML=xmlhttp.responseText;
    
              }
              } 
               var usernm = document.getElementById("username").value;
               var pwd = document.getElementById("password").value; 
               var params = "username=" + usernm + "&password=" + pwd; 
               xmlhttp.open("POST","phpfile.php",true);
               xmlhttp.setRequestHeader("Content-type","application/x-www-form-urlencoded");
               xmlhttp.send(params); 
              //xmlhttp.send(); without parameters
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

First off, I want to say this site is AWESOME! and it helped me
First off - hello, this is my first Stack Overflow question so I'll try
First off, I apologize if this has been asked before. I can't seem to
First off, sorry if this is a stupid question. I installed code::blocks to try
first i want to say that this site has been a really big help
First off, I've done a lot of research on the web (including this site)
First of all, thanks so much to everyone who has helped me on this
it's my first question in this awesome site. I've really searched a lot and
First off, let me preface this question by saying that my professor is firmly
First off I use this code to make the navigation bar always stay fixed;

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.