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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T17:51:26+00:00 2026-05-22T17:51:26+00:00

Step 1: Load a web page with a div foo and jqote2 template tmpl_foo

  • 0

Step 1: Load a web page with a div “foo” and jqote2 template “tmpl_foo” (jqote2 is a jQuery-based templating system).

<div id="foo"></div>

<script type="text/x-jqote-template" id="tmpl_foo">
    <![CDATA[
    <% for (i in this.bar) { %>
            <h3><%= this.bar[i].title %></h3>
            <div class="pane"><%= this.bar[i].desc %></div>
    <% } %>
    ]]>
</script>

Step 2: Fire an ajax query via jQuery to retrieve data from the server, fill the div “foo” using jqote2, and init the jQuery UI accordion on “foo”.

var get_foo : function () {
    $.ajax({
        url     : url,
        type    : "GET",
        data    : "",
        dataType: "json",
        error   : function() { alert("Error loading html document"); },
        success : function(res) {
            $("#foo").empty().append(
                $('#tmpl_foo').jqote({
                'bar': res.bar
                }) 
            ).accordion();
        }
    });
}

$(document).ready(function() {
    get_foo();
});

It works beautifully.

On the web page I also have other links, such as “previous page” and “next page” (standard pager functionality) that also fire get_foo(). These actions also result in getting new data correctly, and the new results are inserted into “foo” correctly as well. However, for some reason the accordion doesn’t get initialized. I am stumped. What could the reason be?

  • 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-22T17:51:27+00:00Added an answer on May 22, 2026 at 5:51 pm

    You have to reset the accordion first:

            $("#foo").empty().append(
                $('#tmpl_foo').jqote({
                'bar': res.bar
                }) 
            ).accordion('destroy').accordion();
    

    You may need to calculate the current accordion item, if you want to keep that state.

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

Sidebar

Related Questions

Exception of type 'System.Web.HttpUnhandledException' was thrown. Step into: Stepping over non-user code 'System.Web.UI.Control.OnLoad' Step
As the last step of my msbuild script I have to load a web
I want a web page to display several random images on load. I've thought
We have two apache/php web servers load balanced with squid page caching proxy. The
My website is setup like: when the page loads, a jQuery animation -- in
I'm somewhat new to web development and I need to develop a user system
I am using apache web server as a load balancer for two tomcat instances
I'm developing a web template using asp.net and c#, which contains 3 parts. I
I have a normalized database and need to produce web based reports frequently that
I am a newbie in Spring based web development. Our site is Spring based

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.