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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T02:56:36+00:00 2026-05-30T02:56:36+00:00

I’m hoping someone might be able to help me move through an issue relating

  • 0

I’m hoping someone might be able to help me move through an issue relating to loading content into a jQuery accordion onclick. Currently the accordion functionality is working and content is being loaded by AJAX, the issue is that I only want to load the content when the user clicks the specific accordion leaf rather than loading all content when the page loads.

HTML:

<div class="accordionButton">Origin</div>
<div class="accordionContent">
    <a href="javascript:void(0)" class="close">Close</a>
    <div id="success_origin"></div>
    <div id="error_origin"></div>
    <script>
        $("#success_origin").load("content_origin.html", function(response, status, xhr) {
            if (status == "error_origin") {
                var msg = "Sorry but there was an error when loading the page's content: ";
                $("#error_origin").html(msg + xhr.status + " " + xhr.statusText);
            }
        });
    </script>
</div>

<div class="accordionButton">Style</div>
<div class="accordionContent">
    <a href="javascript:void(0)" class="close">Close</a>
    <div id="success_style"></div>
    <div id="error_style"></div>
    <script>
        $("#success_style").load("content_style.html", function(response, status, xhr) {
            if (status == "error_style") {
                var msg = "Sorry but there was an error when loading the page's content: ";
                $("#error_style").html(msg + xhr.status + " " + xhr.statusText);
            }
        });
    </script>
</div>

And so on…

Accordion JavaScript:

$(document).ready(function() { 
    $('.close').click(function() {
        $('.close').addClass('hide');
        $('.accordionContent').slideUp('normal');
        $('.accordionButton').addClass('on');
        $('.accordionButton').removeClass('off');
        $('.showHeadline').slideDown('normal');     
    });

    $('.accordionButton').click(function() {
        $('.accordionButton').removeClass('on');
        $('.accordionButton').addClass('off');
        $('.showHeadline').slideUp('normal');
        $('.accordionContent').slideUp('normal');

        //IF THE NEXT SLIDE WASN'T OPEN THEN OPEN IT
        if($(this).next().is(':hidden') == true) {
            $('.close').addClass('show');
            $(this).addClass('on');
            $(this).next().slideDown('normal');
             } 
         });

    $('.accordionButton').mouseover(function() {
        $(this).addClass('over');

    }).mouseout(function() {
        $(this).removeClass('over');                                        
    });

    $('.accordionContent').hide();
});

I’m sure it’s something simple but I’d very much appreciate any help.

Thanks,
@rrfive

  • 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-30T02:56:37+00:00Added an answer on May 30, 2026 at 2:56 am

    I’m not sure if this is what you are asking for, but if you are looking to load content_origin.html when they click the accordion button origin then you can just wrap your AJAX call with a jquery click handler and give each button an id e.g.

    <script>
        $("#origin-button").click(function() {
             $("#success_origin").load("content_origin.html", function(response, status, xhr) {
                  if (status == "error_origin") {
                      var msg = "Sorry but there was an error when loading the page's content: ";
                      $("#error_origin").html(msg + xhr.status + " " + xhr.statusText);
                  }
              });
        });
    </script>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
I used javascript for loading a picture on my website depending on which small
I have a jquery bug and I've been looking for hours now, I can't
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
this is what i have right now Drawing an RSS feed into the php,
I am reading a book about Javascript and jQuery and using one of the
I have a French site that I want to parse, but am running into
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I am currently running into a problem where an element is coming back from
I ran into a problem. Wrote the following code snippet: teksti = teksti.Trim() teksti

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.