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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T07:12:56+00:00 2026-06-13T07:12:56+00:00

I have built a site that uses an index page which has a containing

  • 0

I have built a site that uses an index page which has a containing div for loading each page’s content into.

At first I was including the external js files and doing the initialisations inside each individual page but 8/10 times the page was loaded, the elements relying on plugins being initialised didn’t work but would upon a refresh.

Yesterday I changed the structure so that all external files and all initialisations were done in the index page rather than each individual page.

Now, everything seems to work first time but the second time the page is loaded via ajax the plugins aren’t initialised.

Here is how I am doing it in my index page. (excuse inline js on the nav – wasn’t me!)

// js files included at the top

<div id="navbar">
    <ul class="clearfix">
        <li>
            <a id="myoeHome" onclick="loadContent('/myoe/amb-home.php')" href="javascript:void(0)"> Home </a>
        </li>
        <!-- some more li a's in the nav bar -->
    </ul>
</div>

jQuery

function loadContent(url) {

    // #content is the containing div where each page is loaded into
    $("#content").load(url, function() {

        if (url == '/myoe/amb-home.php') {

            // initialisations etc. for the particular page

        }

    });


}

Any ideas on what I could do to improve the structure? There are even functions inside the loadContent function because I just moved all js for each page into its own if block.

  • 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-13T07:12:56+00:00Added an answer on June 13, 2026 at 7:12 am

    this is my solution. Hope it helped.

    HTML

    <div id="navbar">
        <ul class="clearfix">
            <li>
                <a id="myoeHome"> Home </a>
            </li>
            <!-- some more li a's in the nav bar -->
        </ul>
    </div>
    
    <div id="content"></div>
    

    JS

    $("#myoeHome").live("click",function(){
    
    loadContent('/myoe/amb-home.php');
    });​​​​​​​​​​​​
    
    
        function loadContent(url) {
    
        // #content is the containing div where each page is loaded into
        $("#content").load(url, function() {
    
            if (url == '/myoe/amb-home.php') {
    
                // initialisations etc. for the particular page
    
            }
    
        });
    
    
    }
    ​
    

    ​

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

Sidebar

Related Questions

I have a very complicated site built on CSS3 that has html elements 3d-transformed,
I have a site built in Ruby On Rails which has many ads in
I have an object oriented framework that uses a page design, where each page
I have built a site which requires user to login. Now I have decided
I have built a site in wordpress and the home page is really screwed
I have already built a site from scratch. It has banning, PM, comments, etc.
We have a series of products with built in web servers each of which
I have a site built in ASP.NET MVC and uses heavy jQuery client interaction
I built a really basic php/mysql site for an architect that uses one 'projects'
I have an existing mobile site which I am using Phonegap to turn into

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.