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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T18:03:22+00:00 2026-05-17T18:03:22+00:00

this is my first time really using this site. I’m relatively new to using

  • 0

this is my first time really using this site. I’m relatively new to using ajax with my sites and I ran into a problem a little while ago. The thing is, I’m not sure what my problem is exactly because every time I went over my script, it made sense to me (and it fit with everything I looked up on Google and the jQuery website). Basically, my script doesn’t work at all and I need to get it working somehow. If any of you could please help me, I would greatly appreciate it. Here’s the code:

$(document).ready(function(){  
    $().ajaxSetup({cache: false});
    setInterval("checkAnchor()", 300);  
});  

//Function which check if there are anchor changes, if there are, sends the ajax petition 
var currentAnchor = null;  

function checkAnchor() {  
    //Check if it has changed
    if(currentAnchor != window.location.hash){  
        currentAnchor = window.location.hash;
        var hash = window.location.hash.substr(1);
        var newLink=$('a[href='+hash+']');
        var toLoad = hash+'.html #content';

        $('.current').removeClass('current');
        newLink.addClass('current');

        $('.box').slideUp(1500,function(){
            //Send the petition
            $('.box').load(toLoad,'');
        }); 
        $('#nav').append('<span id="load">LOADING...</span>');
        $('#load').fadeIn('normal');
        $('.box').slideDown(1500,function(){
            $('#load').fadeOut('normal');
            $('#load').remove();
        });
    });
}

And the html file:

<html>
 <head>
  <link rel="stylesheet" type="text/css" href="css/general.css" />
 </head>
 <body>
  <!--Nav Bar-->
  <div id="nav" class="center round">
   <ul>
    <li><a class="current" href="#home">Home</a> | </li>
    <li><a href="#upcomingevents">Upcoming Events</a> | </li>
    <li><a href="#attractions">Attractions</a> | </li>
    <li><a href="#facts">Facts</a> | </li>
    <li><a href="#placestostay">Places to Stay</a> | </li>
    <li><a href="#workscited">Works Cited</a></li>
   </ul>
  </div>


  <!--This is where content is loaded via ajax-->
  <div class="box center round">

  </div>

 <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
 <script type="text/javascript" src="scripts/ajax2.js"></script>
 </body>
</html> 
  • 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-17T18:03:23+00:00Added an answer on May 17, 2026 at 6:03 pm

    I’ve modified your URLs so that they all have the id nav_link and a rel that should carry the url that you want to load.

    <html>
        <head>
            <link rel="stylesheet" type="text/css" href="css/general.css" />
        </head>
        <body>
    
        <!--Nav Bar-->
        <div id="nav" class="center round">
            <ul>
                <li><a href="home.html">            Home</a> | </li>
                <li><a href="upcomingevents.html">  Upcoming Events</a> | </li>
                <li><a href="attractions.html">     Attractions</a> | </li>
                <li><a href="facts.html">           Facts</a> | </li>
                <li><a href="placestostay.html">    Places to Stay</a> | </li>
                <li><a href="workscited.html">      Works Cited</a></li>
            </ul>
        </div>
    
        <a href="shall not trigger" >shall not trigger</a>
    
    
    
    
        <!--This is where content is loaded via ajax-->
        <div class="box center round"></div>
    
        <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
        <script type="text/javascript" charset="utf-8">
    
    
            $(document).ready(function(){ 
    
                $('#nav a').click(function(){
    
                    var the_url = $(this).attr("href");
                    alert( the_url );
                    $(".box").load( the_url );
    
                    return false;
                });
    
    
            });  
    
    
        </script>
    
    
        </body>
    </html>
    

    As you can see, the jQuery code is fairly simple so it track’s all clicked id’s with nav_link and looks for the propper url and loads it to your box.

    Hope it helps!

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

Sidebar

Related Questions

I have found this example on StackOverflow: var people = new List<Person> { new
This is beyond both making sense and my control. That being said here is
I'm trying to build a C++ extension for python using swig. I've followed the
I am attempting to pull some information from my tnsnames file using regex. I
I am using a 3rd-party rotator object, which is providing a smooth, random rotation
I want to use a temp directory that will be unique to this build.
I have a new web app that is packaged as a WAR as part
After having read Ian Boyd 's constructor series questions ( 1 , 2 ,
I was reading JavaScript: The Good Parts and the author mentions that JavaScript is
Let say I have the following desire, to simplify the IConvertible's to allow me

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.