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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T20:53:38+00:00 2026-05-25T20:53:38+00:00

I have 3 output in following jQuery.each() , i want echo( append ) each

  • 0

I have 3 output in following jQuery.each(), i want echo(append) each a of they in one tag li.

Like:

This is output $.each(): how & hello & hi

I want this:

<ol>
    <li>
        <a href="">how</a>
    </li>
    <li>
        <a href="">hello</a>
    </li>
    <li>
        <a href="">hi</a>
    </li>
</ol>

But following jquery code append all 3 times in the a li, as:(i not want this)

<ol>
    <li>
        <a href="">howhellohi</a>
    </li>
    <li>
        <a href="">howhellohi</a>
    </li>
    <li>
        <a href="">howhellohi</a>
    </li>
</ol>

This is my jquery code:

$.ajax({
    type: "POST",
    dataType: "json",
    url: 'get_residence',
    data: dataString_h,
    cache: false,
    success: function (respond) {
        $.each(respond.data, function (index, value) {
            $('ol li').append('<a href="" class="tool_tip" title="ok">' + value.name[index] + '</a>');
        });
    },
    "error": function (x, y, z) {
        alert("An error has occured:\n" + x + "\n" + y + "\n" + z);
    }
});

This is my respond in jquery code:

{
    "data": [{
        "name": "how",
        "star_type": "5-hotel",
        "site": "www.sasaas.assa",
        "service": ["shalo", "jikh", "gjhd", "saed", "saff", "fcds"],
        "address": "chara bia paeen"
    }, {
        "name": "hello",
        "star_type": "4-motel",
        "site": "www.sasasa.asas",
        "service": ["koko", "sili", "solo", "lilo"],
        "address": "haminja kilo nab"
    }, {
        "name": "hi",
        "star_type": "3-apparteman",
        "site": "www.saassaas.aas",
        "service": ["tv", "wan", "hamam", "kolas"],
        "address": "ok"
    }]
}

How can fix it?

  • 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-25T20:53:39+00:00Added an answer on May 25, 2026 at 8:53 pm

    I think this is the logic you’re after:

    $.each(respond.data, function (index, value) {
        $('ol li').eq(index).append('<a href="" class="tool_tip" title="ok">' + value.name[index] + '</a>');
    });
    

    This will add the data to the proper list item, not the same data to all list items.

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

Sidebar

Related Questions

I have the following jQuery which I want to output a list of images.
I want append some from array by jQuery.each and data hotel_id , number each
I have the following output (via link) which displays the var_dump of some XML
In my current repo I have the following output: $ git branch -a *
I have an json output of the following (ignore the escape characters) {\sEcho\:1,\iTotalRecords\:10,\iTotalDisplayRecords\:10,\aaData\:[{\Job\:\developer\,\Name\:\kurt\},{\Job\:\plumber\,\Name\:\john\}]} which
Can someone tell me how I can make the following output? I have a
I have the following query in iSeries SQL which I output to a file.
Hi I have following XAML code which is the output from XamlWriter.Save(): <StackPanel Name=itemStack
If you have the following code: cout << hex << 10; The output is
Hi I have the following date as String format. Input 2010-04-20 05:34:58.0 Output I

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.