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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T03:18:39+00:00 2026-06-17T03:18:39+00:00

I am fetching some json and returning it out, creating a new div for

  • 0

I am fetching some json and returning it out, creating a new div for each object. I am now trying to add one final div (not from json) that just says something along the lines of ‘This could be yours!’.

I have tried to insert

$('section#fans').append('<div class="fan">new div</div>');

or several variations of that (after, appendChild etc) and cannot get it to perform as i wish. Currently it adds one new div but before the foreach kicks in and it doesn’t follow the fadeIn delay pattern that for the foreach does.

How can i get it to add the div with the same effect after the foreach. as one final div? As if it belonged to the json, altough it wont be the same template as the previous.

function get_fans(){

    $.ajax('http://localhost/facebook_app/selectFans/', {
        type : 'get',
        dataType: 'json',
        success : function (data) {
            $.each(data, function(index) {setTimeout(function(){

                var first_name = data[index].first_name;
                var location = data[index].location;
                var imagePath = data[index].image_path;

                var d = $('<div class="fan"><img src="http://localhost/uploads/' + imagePath + '" width="170" height="160" />' + first_name + ', ' + location +'</div>');
                $('section#fans').append(d);
                d.hide();
                d.fadeIn('50');

                }, 250*(index +1));


            });

            $('section#fans').append('<div class="fan">new div</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-17T03:18:40+00:00Added an answer on June 17, 2026 at 3:18 am

    Your “final” insert is done immediately, while the other ones are done after a timeout.

    You could replace

    $('section#fans').append('<div class="fan">new div</div>');
    

    with

    setTimeout(function(){
        $('#fans').append('<div class="fan">new div</div>');
    }, 250*(data.length +2));
    

    so that the final insert would be done after all others have been done.

    A side note : don’t use $('section#fans') but $('#fans'). This will be faster as jQuery will use the fast document.getElementById function.

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

Sidebar

Related Questions

In my rails app the model is fetching some XML and returning an array.
I'm fetching some settings out of the database based on a value passed from
I'm fetching some data from FB using the following code: dynamic parameters = new
I'm fetching some JSON from flickrs API. My problem is that the exif data
I'm trying to encode some user input I'm fetching from a database and then
I am fetching a json from server, json have some attributes where the value
In one of my applications, i am fetching json data from php and rendering
I'm fetching some objects out of a data store but the results aren't what
I just fetched some data from JSon and listed into my Listview. It's fetching
I am fetching some data from a site using its API-key and some other

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.