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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T23:13:42+00:00 2026-05-22T23:13:42+00:00

I recieve from an AJAX call data which has an architecture like data [0]

  • 0

I recieve from an AJAX call data which has an architecture like

data
[0] =>
      "date" => "blah"
      "location" => "blah"
      ...
[1] =>
      "date" => "moreblah"...................

I would like to create nested divs for each of the elements in data like this

blah
blah
…

moreblah
…
…..

I have:

for(var i in data){
    $("<div class='event_item'>").appendTo("#thelist");
    //make div class "date" with event.date inside
    $("<div class='date'>" + data[i].date + "</div>").appendTo("#thelist");
    //make div class "location" with event.location inside
    $("<div class='location'>" + data[i].location + "</div>").appendTo("#thelist");
    //make div class "descrip" with event.descrip inside
    $("<div class='descrip'>" + data[i].description + "</div>").appendTo("#thelist");
    //make div class "detail" with event.extra inside
    $("<div class='detail'>" + data[i].extra + "</div>").appendTo("#thelist");
    $("</div>").appendTo("#thelist");
}

this doesn’t work.. what i really want to do is append it to the newly created “event” div… not the list… how can i do that?

Thanks!!!

  • 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-22T23:13:42+00:00Added an answer on May 22, 2026 at 11:13 pm

    Try something like this: also, make sure use always create complete html tags. You’re adding dom elements, not printing something to the document, Thus: do’s: $('<div></div>);. Dont’s: $('</div>').

    for(var i in data){
    
        var event = $("<div class='event_item'></div>");
        //make div class "date" with event.date inside
        $("<div class='date'>" + data[i].date + "</div>").appendTo(event);
        //make div class "location" with event.location inside
        $("<div class='location'>" + data[i].location + "</div>").appendTo(event);
        //make div class "descrip" with event.descrip inside
        $("<div class='descrip'>" + data[i].description + "</div>").appendTo(event);
        //make div class "detail" with event.extra inside
        $("<div class='detail'>" + data[i].extra + "</div>").appendTo(event);
        console.log(event);
        $(event).appendTo('#theList');
    }
    

    To play around with it, see the jsfiddle: http://jsfiddle.net/Fn3Fm/

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

Sidebar

Related Questions

For an ajax call like: $.ajax({ .... success :function(data){ }, error :function(error){ }); Is
I need to create a table from an array recieved with an ajax call.
I have a user interface in .net which needs to receive data from a
I'm trying to call a server-side action in a controller from jQuery: $.ajax({ url:'http://localhost:88/admin/business/11/GetChildBusinessTypes',
I have a jQuery ajax call in which I am trying to send the
I have a simple web method and ajax call and continue to recieve an
I make an AJAX call to a PHP script like so: function convertNow(validURL){ $.ajax({
just been trying to recieve the session value from multiple jquery ajax requests on
I'm just wondering..is it possible to receive multiple responses from a single ajax call?
I need a server to send and recieve XMPP messages from Android clients running

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.