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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T21:08:10+00:00 2026-06-04T21:08:10+00:00

I built a pretty basic dynamic AJAX function to load in content onto the

  • 0

I built a pretty basic dynamic AJAX function to load in content onto the current page using jQuery.

I tested it on a pretty generic page and got it working without a hitch, however as soon as I put this code into the actual production site I wanted it for it just doesn’t work.

I’ve tried every which way to get this to work, so I’m not sure what else to do now. I have a niggling feeling that I’ve used the wrong selectors in the production site. Although that is probably just from a lack of confidence (beginner) I actually think that the jQuery just isn’t working at all.

Here’s the code:

    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
    <script> $(document).ready(function(){
        var a = $('article.announce');
        var s = $('#info li a');
        // You only need to change the above two pieces of code.    

            s.click(function(){
                var url = $(this).html(),
                    clicked = $(this).attr('data-id');



                    $(s+'[data-id='+clicked+']').click(function(){
                        a.load(url+'.html')


                    }); 
}); 
});</script>

The HTML I’m trying to target is as follows:

    <aside id="info" class="clearfix">
<h1>About Us &gt;</h1>
<h2>Other Stuff:</h2>
<ul>
    <li><a href="#" data-id="1">About</a></li>
    <li><a href="#" data-id="2">Contact</a></li>
    <li><a href="#" data-id="3">Examples</a></li>

</ul>



</aside>
<article class="announce">
<p>Text to be replaced will be here!</p>




</article>

Hopefully I’ve given you enough information to see what’s wrong here. Thanks.

  • 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-04T21:08:11+00:00Added an answer on June 4, 2026 at 9:08 pm

    Change the HTML markup:

    <aside id="info" class="clearfix">
        <h1>About Us &gt;</h1>
        <h2>Other Stuff:</h2>
        <ul>
            <li><a href="about.html">About</a></li>
            <li><a href="contact.html">Contact</a></li>
            <li><a href="example.html">Examples</a></li>
        </ul>
    </aside>
    
    <article class="announce">
        <p>Text to be replaced will be here!</p>
    </article>
    

    Then do this:

    $(function() {
        var a = $('.announce');
        $('#info li a').on('click', function(e) {
            e.preventDefault();
            a.load($(this).attr('href'));
        });
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a pretty large site and every page is built from several included
I have built a report pretty basic just a table wiht 45 rows of
I've built a very basic jQuery plugin that essentially positions a sprite image left
Using PyroCMS 1.3.1 I've built a model that's pretty much a copy-paste version of
I have built a pretty simple REST service in Sinatra, on Rack. It's backed
I built a website which runs on localhost and is pretty big by now.
Mathematica's list of built-in formats is pretty extensive; however, JSON is not on that
I have built a PHP calendar system and have pretty much everything done but
I built a very simple app using a PHP form with a bit of
I have a pretty basic app flow that is quite linear, so it fits

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.