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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T20:22:27+00:00 2026-06-14T20:22:27+00:00

I load external content using ajax with the help of a navigation. Everything is

  • 0

I load external content using ajax with the help of a navigation.

Everything is working fine. The user also can’t load the same content again if he is clicking oftener of the menu tab. But if the user is the first time on the website he is able to load the content again (first menu tab).

I want that this isn’t possible for the user.

Here is the JavaScript:

$.get('header/1.php', function(data) {
    $('.contentHeader').html(data);
}); 

$.get('content/1.php', function(data) {
    $('.content').html(data);
}); 

$.get('advertisement/1.php', function(data) {
    $('.advertisement').html(data);
}); 
var current;
$(".navigation li").click(function() {
    var source = $(this).attr('id') + ".php";

    // the current content doesn't load again
    if(current === source) {
        return;
    }

    current = source;

    // content
    $(".content").fadeOut(function() {
        $(this).load("content/" + source).fadeIn('normal');
    })

    // advertisement
    $(".advertisement").fadeOut(function() {
        $(this).load("advertisement/" + source).fadeIn('normal');
    })

    // header
    $(".contentHeader").fadeOut(function() {
        $(this).load("header/" + source).fadeIn('normal');
    })

});

Here is the html code:

<div class="navigation">

        <ul>
            <li id="1">
                <div id="menuImage1" class="menuImage"></div>
                <div class="menuText"><p>1</p></div>
            </li>
            <li id="2">
                <div id="menuImage2" class="menuImage"></div>
                <div class="menuText"><p>2</p></div>
            </li>
            <li id="3">
                <div id="menuImage3" class="menuImage"></div>
                <div class="menuText"><p>3</p></div>
            </li>
            <li id="4">
                <div id="menuImage4" class="menuImage"></div>
                <div class="menuText"><p>4</p></div>
            </li>
            <li id="5">
                <div id="menuImage5" class="menuImage"></div>
                <div class="menuText"><p>5</p></div>
            </li>
            <li id="6">
                <div id="menuImage6" class="menuImage"></div>
                <div class="menuText"><p>6</p></div>
            </li>
        </ul>

    </div>
  • 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-14T20:22:28+00:00Added an answer on June 14, 2026 at 8:22 pm

    i think you should initialize the current variable.

    i.e -:

    $.get('header/1.php', function(data) {
        $('.contentHeader').html(data);
    }); 
    
    $.get('content/1.php', function(data) {
        $('.content').html(data);
    }); 
    
    $.get('advertisement/1.php', function(data) {
        $('.advertisement').html(data);
    }); 
    var current = "1.php";
    $(".navigation li").click(function() {
        var source = $(this).attr('id') + ".php";
    
        // the current content doesn't load again
        if(current === source) {
            return;
        }
    
        current = source;
    
        // content
        $(".content").fadeOut(function() {
            $(this).load("content/" + source).fadeIn('normal');
        })
    
        // advertisement
        $(".advertisement").fadeOut(function() {
            $(this).load("advertisement/" + source).fadeIn('normal');
        })
    
        // header
        $(".contentHeader").fadeOut(function() {
            $(this).load("header/" + source).fadeIn('normal');
        })
    
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Possible Duplicate: load content from external page into another page using ajax/query May be
I'm trying to load some external content using jQuery load function to div on
I need to load content from an external page when the user clicks on
I have this jQuery code that retrieves external content using ajax, without refereshing the
I'm using a jQuery function to load external content from another page on my
I want to load external content (from another domain) and simulate navigation, doing things
I'm using http://pdfobject.com/ jquery library to load the external pdf files into an html
I have some tabs that load ajax content. When I click on the tabs
I need to use ajax feature to load an external div element (an external
I am using colorbox to AJAX some external HTML onto a page. My client

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.