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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T19:56:10+00:00 2026-06-18T19:56:10+00:00

I am making a service call using collection url. The service returns some json,

  • 0

I am making a service call using collection url. The service returns some json, the json length is 13 (in short 13 rows of data).

Here, this.Collection.fetch() is returning json who’s length is 13.
but this.Collection.toJSON() is returning json who’s length is 12.
instead it should return length 13.

In collection parse, the response is returning json who’s length is 13, which is correct!

tableTemplate is object of template (template is done using Handlebars.js).

this.Collection.fetch({
success: function(){

        console.log("Collection Fetch 2:");
        console.log(this.Collection.fetch());

        console.log("Collection toJSON: ");
        console.log(this.Collection.toJSON());
        console.log(this.Collection.toJSON().length);


        var markup = tableTemplate({List:self.importCollection.toJSON()});
         ...
          ...
    }
});
  • 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-18T19:56:11+00:00Added an answer on June 18, 2026 at 7:56 pm

    Thats the asynchronous nature of javascript/backbone

    do it like this :

    this.collection.fetch();
    
    //Fetch() is asynchronous call , when it completes fetching it triggers the **reset**   event so you need a event listener for **reset**
    
    this.collection.on('reset',function(data){
    console.log(data);                          // this will log the object
    });
    
    this.collection.on('reset',function(data){
    console.log(JSON.stringify(data));        // This will log the JSON data  
    });
    

    OR you could do this :

    this.collection.fetch({
    success : function(){                      // called on completion of fetch()
    console.log(data);       
    console.log(JSON.stringify(data));  
    }
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am calling a Java web service, which returns some data. When I look
When making a call to a web service running on a server using HTTPS
I am making WCF service call using MyViewRequest view fields inside HttpPost ActionHandler. The
I'm making a RESTful web service call in my JavaScript page and get the
I am making a call to a web service, the results of the web
Ok I am making a call to a web service to get policies back.
I am working on making a web service using soap. I'm stuck at trying
Within an asp webform project I am making a call to a web service
I'm making a call to a WCF service but I get a CommunicationException on
When I'm making web service calls from Silverlight using a service reference, is there

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.