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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T13:11:28+00:00 2026-05-31T13:11:28+00:00

From all the answers I’ve been given, I’ve decided to use the object reference

  • 0

From all the answers I’ve been given, I’ve decided to use the object reference variable since I need .data to have the same name. However I’m not sure if I am using the variable correctly. I think I just need to do the following:

                      var myData = [];


                    $.ajax({
                            url: url,
                            dataType: "json",
                            cache: true,
                            success: function(data) {           
                            $.each(data, function(i, item){
                      myData.push(item);

                      });
                       alert(myData);  

Unfortunately its still not working correctly..

when I call the function onload i get the following output from the alert 10,
” [object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]”

when I call the function a second time to get the next 10, I should have 20 objects in the file but instead I have only 10 “object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]”

ORIGINAL POST BELOW

Good day,

I am trying to add to some results from an Ajax call. Currently json gives me 10 items. When I call my loading function again, I want another 10 but I want to add it to the .data object so I get 20, then when it loads again 30, etc.
Is this possible to do?

The first call gives me back 10 results. It is:

$.ajax({
    url: url,
    dataType: "json",
    cache: true,
    success: function(data) {           

    }
});

I have set the following conditions for the second call.

if(data ===! null || data ===! 0 || data ===! ""){          
    $.each(data, function(i, item){
        data.push(item.text);
    });

The second call is not adding to data at all. I’m not sure what I should do. I have read from other questions that data is an object that holds an array. Why can’t I just push 10 more to the array? Any help is appreciated.

Thank you

  • 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-31T13:11:28+00:00Added an answer on May 31, 2026 at 1:11 pm

    You need to create an object to store the data into. The data that you are fetching each time is not the same object, so that is why you aren’t seeing the additions. What you may want to consider is having just a single function, and have it behave like this:

    myData = [];
    
    $.ajax({
        url: url,
        dataType: "json",
        cache: true,
        success: function(data) {           
            $.each(data, function(i, item) {
                myData.push(item.text);
            });
        }
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm fetching data from all 3 tables at once to avoid network latency. Fetching
Order deny,allow deny from all allow from xx.xx.x.xx RewriteRule . - [F] I have
I want to learn WPF but from all the commentary I've been hearing the
I have 4 Tables (listed bellow) and need: get last 10 Chats from Room
I have the following Execution statement which creates a table (using data from another
with plenty of visits i found helpful answers from all of you and hope
So I have 0.5MB XML file with data for my iPhone application. It's all
I'm beggining with MYSQL. I have the following query: SELECT answers.data. * , COUNT(
The Question Aside from all the obvious answers, what would cause extension methods to
I have data coming from an nvarchar field of the SQL server database via

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.