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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T19:06:24+00:00 2026-06-04T19:06:24+00:00

I am writing a function to dynamically load jQuery UI accordian leaves with content.

  • 0

I am writing a function to dynamically load jQuery UI accordian leaves with content. I know (think) the AJAX part works as I lifted it from another working AJAX loader I have, but the function as a whole does not work.

The code:

    function load_leaf(link){
    var link = link;
    $.ajax({
            cache : false,
            type : 'POST',
            async: false,
            url : 'includes/'+ link +'.php?'+ new Date().getTime(),
            dataType : 'text',
            data: {
                owner : '$user_id'
            },
            success: function(msg){
                $("#" + link).html(msg);
                console.log('Can\'t see me in Chrome, but ok in firefox !')
            },
            error: function() {
                console.log($.makeArray(arguments));
            },
            complete: function() {
                console.log($.makeArray(arguments));
            }

    });
};
$(function(){
    $('.accordian').click(function(){
        var link = this.getAttribute("link");
        load_leaf(link);
    });
});     

For whatever reason this does not work. The break point seems to be this line
$("#" + link).html(msg);
Specifically the selector, as a hard coded selector works perfectly. The link variable is correctly filled i know this as i can alert the value correctly. The link is not the problem as i replaced the whole ajax function with a simple add class and it a still did not work, it also broke at the selector.

EDIT:
This is the div as printed by php:

<h3 class="accordian" id="'.$tab_id.'" link="'.$tab_link.'" >
 <a href="#">'.$tab_name.'</a>
</h3>
<div id="'.$tab_link.'"><p>Hi</p></div>

The html for the first one is:

 <h3 class="accordian" id="accordian_manage.php" link="accordian_manage.php" ><a href="#">Manage Images</a></h3><div id="accordian_manage.php"><p>Hi</p></div>
  • 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-04T19:06:26+00:00Added an answer on June 4, 2026 at 7:06 pm

    Your ID has a period . in it, which jQuery interprets as a chained class selector.

    You can either change your link/IDs, or use this hack:

    $("[id='" + link + "']");
    

    Live demo

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

Sidebar

Related Questions

For an application I am writing, I have the need to dynamically load content
I'm writing a javascript function that dynamically creates an Iframe with a button that
I am writing a Function that has a return-type which will dynamically change depending
I am writing a function which would get all files from a particular directory
I am writing a function to dynamically generate my sitemap and sitemap index. According
I am writing a JQuery mobile application. In this application, I need to dynamically
I am writing a function that would take table-name as argument. I know the
This page allows users to add questions dynamically (this part works), within each question
I am writing a jQuery plugin that references another plugin, I dynamically add the
I' m writing a web app that needs to load dynamically a lot of

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.