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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T02:04:16+00:00 2026-06-02T02:04:16+00:00

I have a question to those jquery/ajax/javascript veterans, im creating a skill calculator for

  • 0

I have a question to those jquery/ajax/javascript veterans, im creating a skill calculator for a certain game… everything is working fine up until this:

this is the ajax output:

{"skills":{"skill_id_1":"skill_name_1","skill_id_2":"skill_name_2"}}

this is my ajax:

function setOutput(){
    if(httpObject.readyState == 4){
    var results = eval('('+httpObject.responseText+')');
    if (results['skills']){
    $('#skilldiv').empty(); // empty div
    $.each(results['skills'], function(key, value)
    {
        $("<div></div>").appendTo("#skilldiv").attr({class: "skilldesc"});
        $("<div>&nbsp;</div>").appendTo(".skilldesc").attr({class: "skillinfo"});
        $("<div>&nbsp;</div>").appendTo(".skilldesc").attr({class: "skilltxt"});
    });
    }
    }
}

this is my div:

<div id="wrapper">
    <ul>
        <li id="skilldiv"></li>
    </ul>
</div

so my problem is.. how can i append skillinfo & skilltxt to skilldesc which is just appended to skilldiv…

i tried this:

$.each(results['skills'], function(key, value)
{
    $("<div></div>").appendTo("#skilldiv").attr({class: "skilldesc"});
    $("<div>&nbsp;</div>").appendTo(".skilldesc").attr({class: "skillinfo"});
    $("<div>&nbsp;</div>").appendTo(".skilldesc").attr({class: "skilltxt"});
});

but all results go into the first skilldesc,

im trying to get these:

<div id="wrapper">
    <ul>
        <li id="skilldiv">
            <div class="skilldesc">
                <div class="skillinfo">Some Info of skill 1 here</div>
                <div class="skilltxt">Name of skill 1 here</div>
            </div>
            <div class="skilldesc">
                <div class="skillinfo">Some Info of skill 2 here</div>
                <div class="skilltxt">Name of skill 2 here</div>
            </div>
        </li>
    </ul>
</div>

but i get this instead;

<div id="wrapper">
    <ul>
        <li id="skilldiv">
            <div class="skilldesc">
                <div class="skillinfo">Some Info of skill 1 here</div>
                <div class="skilltxt">Name of skill 1 here</div>
                <div class="skillinfo">Some Info of skill 2 here</div>
                <div class="skilltxt">Name of skill 2 here</div>
            </div>
            <div class="skilldesc"></div>
        </li>
    </ul>
</div>

any help would be very much appreciated . . . thx

  • 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-02T02:04:17+00:00Added an answer on June 2, 2026 at 2:04 am

    Because .skilldesc selects the first div too.

    You can try this,

    $.each(results['skills'], function(key, value)
    {
        $skilldesc = $("<div></div>").attr({class: "skilldesc"});
        $("<div>&nbsp;</div>").appendTo($skilldesc).attr({class: "skillinfo"});
        $("<div>&nbsp;</div>").appendTo($skilldesc).attr({class: "skilltxt"});
        $skilldiv.appendTo("#skilldiv");
    
    });
    

    Also, you should to manipulations in objects in memory (not in dom).

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

Sidebar

Related Questions

My question is about an error I have when I use jQuery.ajax in my
Have a Android technique question for those seasoned vets out there... I want to
This is a similar question to those that have been asked before, but still
Some people have mentioned RockScroll and MetaScroll in This Question , but those only
T-SQL DateTime Question. I have a set of time ranges. During those time ranges
I have a page with a menu that uses JQuery AJAX calls to populate
I am creating a javascript API for SCORM 2004 4th Edition. For those who
I have a web page with several jQuery ajax calls which fire asynchronously at
My javascript client makes a JSONP request via the JQuery $.ajax() method every second.
This is a follow-up to this question: Using javascript:function syntax versus jQuery selector to

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.