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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T01:11:25+00:00 2026-05-24T01:11:25+00:00

Ive got this code: loadData : function(jsonArray) { var id = $(this).attr(id); for(var i

  • 0

Ive got this code:

loadData : function(jsonArray) {
var id = $(this).attr("id");

for(var i in jsonArray) {
    $("#"+id+" tbody").append('<tr class="entry-details page-1 entry-visible" id="entry-'+i+'"></tr>');

    var header = {
        1: "time",
        2: "project",
        3: "task"
    }
    var col = 1;
    while(col <= jsonArray[i].length) {
        $("#"+id+" tbody #entry-"+i).append("<td>"+jsonArray[i][header[col]]+"</td>")
        col++
}}

It will take a JSON array that looks similar to the following

{"1":{"project":"RobinsonMurphy","task":"Changing blog templates","time":"18\/07\/11 04:32PM"},"2":{"project":"Charli...

The code should loop through the rows (which it does), and then loop through the colums of data.

The problem I am facing is in order to place the column data in the correct column, I need to calculate how many pieces of data are being returned in a row. I tried jsonArray[i].length, however this returns undefined.

Any help would be appreciated

  • 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-24T01:11:26+00:00Added an answer on May 24, 2026 at 1:11 am

    You do not have any arrays at all, only objects.

    To count items in an object, create a simple function:

    function countInObject(obj) {
        var count = 0;
        // iterate over properties, increment if a non-prototype property
        for(var key in obj) if(obj.hasOwnProperty(key)) count++;
        return count;
    }
    

    Now, you can call countInObject(jsonArray[i]).

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

Sidebar

Related Questions

ok ive got this code: public static string ScreenScrape(string url) { System.Net.WebRequest request =
Ive got this following code in VB, want to use it into c# and
Hey guys ive got the following code in my Model require 'RMagick' class Upload
This is probably a simple thing, but ive got the following code: <div> @using
Ive got ASP.NET web application form where users enter details such as: Subject Code
Ive got this code from an ebook tutorial on embedding MPMoviePlayerController from a VIEW
I have a web application. On my page ive got this: <div id=myDiv runat=server
I've got this code: rs1 = getResults(sSQL1) rs2 = getResults(sSQL2) rs1 and rs2 and
I've got this code in a pair of button click event handlers on a
I've got this code here: SqlCommand CodeStatus = new SqlCommand(SQL, DB); DB.Open(); Reader =

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.