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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T10:59:19+00:00 2026-06-08T10:59:19+00:00

I am writing the code for getting the accordion contents when I click on

  • 0

I am writing the code for getting the accordion contents when I click on the button. The inner contents for the accordion are being received from the sever using ajax call.These contents are displayed inside a dialog box.

Now the problem is that the contents (originally supposed to be accordion contents) can be seen in the dialog box as simple html and not as accordion (with buttons). If I just use the same contents in the html file(paste the contents received from the server inside the “” they work fine and I can see the accordion in the dialog box.

Whats going wrong? Is it related to that the accordion contents need to be given before hand. Can anyone suggest a way to fix this. (the contents of the accordion will change every time that’s why they are being received from the server)

Javascript function is:

<script>
     $(document).ready(function() {
    $("#accordion").accordion({
    autoHeight: false
});
     </script>


<script language="javascript"> 

    function Faulttest() 
    {

    var xmlhttp;
    if (window.XMLHttpRequest)
    {xmlhttp=new XMLHttpRequest();}
    else
    {xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");}
    xmlhttp.onreadystatechange=function()
    {
    if (xmlhttp.readyState==4 && xmlhttp.status==200)
    {
    Here we get the contents which should be inside the accordion which we receive from the server



> **document.getElementById("accordion").innerHTML=xmlhttp.responseText;**



    }
    }
    xmlhttp.open("GET","http://****/Anomalies/index.jsp",true);
    xmlhttp.send();
}

Html contents of page are:

<body style="font-size:62.5%;"  >
        <div id="page">         
        <div id="header"><h1>header</h1></div>          
        <div id="body" >
            <h1>content top </h1>                       
        <div id="dia">
        <div id="dialog" title="Detailed FeedBack"><div id="accordion">

        // CODE SHOULD GO HERE


        </div>
            </div>
                </div>
   <button type="button" onclick="Faulttest();">Click Me!</button>  
  </body>
  • 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-08T10:59:21+00:00Added an answer on June 8, 2026 at 10:59 am

    Without knowing exactly how the accordion script works, I’m assuming it’s because the script assumes that the contents within the #accordion upon initialization are the contents with which the script will need to work with.

    If it’s possible with your implementation, put empty divs inside the #accordion (or whatever the accordion script specifies for child nodes) and populate those dynamically instead.

    Otherwise, wait to initialize the accordion on the #accordion node until after the AJAX call is returned.

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

Sidebar

Related Questions

I'm writing code to access the i2c driver(from kernel space) using the standard interface
i'm writing some code for getting some values including course -(void) locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation
i am writing code for btree algorithms. i am getting NullPointerException . why???? please
I am writing code to clone object but have no cue from Hobo documentation.
Below is the code that I am writing in HTML and I'm getting what
I am currently trying to get into writing proper C++ code (getting it running
I am using the Mono.Cecil DLL file and writing this code: AssemblyDefinition sourceAssembly =
I am just writing the following code and getting some issue on mBtAdapter.startDiscovery();, I
I'm now making the transition towards writing all my javascript code using Coffeescript, But
I am writing code to migrate data from our live Access database to a

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.