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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T17:21:13+00:00 2026-06-16T17:21:13+00:00

I am using jQuery address and I can’t get it to initialize on refresh…(In

  • 0

I am using jQuery address and I can’t get it to initialize on refresh…(In all major browsers except IE) Here are the issues…

When I click on a link the ajax loads it loads perfectly and adds the class “selected” to the link as it is supposed to. When I use the back button it works perfect also, but after I click the link then hit the refresh button, it reloads the original state (minus the ajax) and will not add the class “selected” to any links or load anymore ajax thereafter.

Here is the link to the page. http://www.weightlossexp.com/articles

Any help is greatly appreciated, thanks in advance.

[Edit] Code

Jquery

var init = true, 
        state = window.history.pushState !== undefined;
        // Handles response
        var handler = function(data,topic,w) {
          $("#title_back h1").hide().html(topic).fadeIn(800);
          $('title').html(topic);
          $('#content').html(data).animate({width:w},1500);
          $('#lc').show();
          // $.address.title(/>([^<]*)<\/title/.exec(data)[1]);
        };
        $.address.state('/articles').init(function() {
            // Initializes the plugin
            $('#lc a').address();                
        }).change(function(event) {
            // Selects the proper navigation link
            $('#lc a').each(function() {
                //alert($(this).attr('href')+' - - '+$.address.state() + event.path);
                if ($(this).attr('href') == ($.address.state() + event.path)) {
                    $(this).addClass('selected').focus();
                } else {
                    $(this).removeClass('selected');
                }
            });
            var classL = $(".selected").length;
            if(classL == 1){
                var topic = $('.selected h2').html();
                var action = event.path.substr(1);
                var width = '100%';
            }else{ 
                var topic = "Topics"; 
                var action = '';
                var width = '0px';
            }
            if (state && init) {
                init = false;
            } else {
                // Loads the page content and inserts it into the content area
                $.ajax({
                    url: "scripts/ajax/getSubTitles.php",
                    data: {action:action},
                    type: "post",
                    success: function(data, textStatus, XMLHttpRequest) {
                        handler(data,topic,width);
                    }
                });
            }
        });

Html

<div id="lc" style="position:absolute; overflow:hidden;">
                    <a href="/articles/ap" id="ap"><div class="topics" style="border-top:1px solid #d1d1d1; margin-top:20px;"><h2>Anatomy and Physiology</h2></div></a>
                    <a href="/articles/end" id="end"><div class="topics"><h2>Endurance</h2></div></a>
                    <a href="/articles/flex" id="flex"><div class="topics"><h2>Flexibility</h2></div></a>
                    <a href="/articles/myth" id="myth"><div class="topics"><h2>Myths</h2></div></a>
                    <a href="/articles/nut" id="nut"><div class="topics"><h2>Nutrition 101</h2></div></a>
                    <a href="/articles/corr" id="corr"><div class="topics"><h2>Post-Rehab/Corrective Exercise</h2></div></a>
                    <a href="/articles/power" id="power"><div class="topics"><h2>Power</h2></div></a>
                    <a href="/articles/stab" id="stab"><div class="topics"><h2>Stability</h2></div></a>
                    <a href="/articles/str" id="str"><div class="topics"><h2>Strength/Resistance Training</h2></div></a>
                    <a href="/articles/supp" id="supp"><div class="topics"><h2>Supplements</h2></div></a>
                    <a href="/articles/wg" id="wg"><div class="topics"><h2>Weight Gain</h2></div></a>
                    <a href="/articles/wl" id="wl"><div class="topics"><h2>Weight Loss</h2></div></a>
                <div id="content">
                </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-16T17:21:15+00:00Added an answer on June 16, 2026 at 5:21 pm

    the problem with your code is that in the lines which you have included your javascripts

    <script type="text/javascript" src="lib/jquery-1.7.2.min.js"></script>
    <script type="text/javascript" src="lib/jquery.address-1.5.min.js"></script>
    

    after clicking on the link, the URL will change from

    http://www.weightlossexp.com/articles

    to

    http://www.weightlossexp.com/articles/something

    and those two js files can not be found in the new url so both jquery and jquery.address will not be loaded.

    just start the path of your JS files with a slash ‘/’ and your code will work fine.

    so the code will be like this:

    <script type="text/javascript" src="/lib/jquery-1.7.2.min.js"></script>
    <script type="text/javascript" src="/lib/jquery.address-1.5.min.js"></script>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to know how to get client IP address using jQuery? Is it
Using jQuery, how can I get the selected item's value in a select when
Using jQuery, how can I get the input element that has the caret's (cursor's)
Im using jQuery's validation which can be found here: http://docs.jquery.com/Plugins/Validation/rules#.22add.22rules I currently have some
Using jquery, how can I change the color of these elements to red if
I'm using jQuery Address to load in my content, but it's doing it twice
How can I create a dynamic form using jQuery. For example if I have
I am using jQuery to grab results from a webservice(3rd party can't change). A
I'm using jQuery UI Select Menu and occasionally have some issues. This is located
I am using jQuery's Address plugin ( website ) to enable the back/forward buttons

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.