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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T21:55:18+00:00 2026-06-02T21:55:18+00:00

I am a newbie with json arrays/objects. I am trying to get to some

  • 0

I am a newbie with json arrays/objects. I am trying to get to some subobjects within my .json file. I have tried the suggestions on here, but I keep getting “undefined” results. Here is the .json —

{
  "DACcourses": [
    {
       "longTitle": "<a href='#'>Ammo-29 Electrical Explosives Safety for Naval Facilities</a>",
      "longDescript": "ammo-29.html",
      "atrrsLink": "Win 95+",
      "delMeth": "standard",
      "sked": [
        {
         "classNumb": "926",
          "startDate": "4/16/2012",
          "endDate": "4/20/2012",
          "location": "NMC Fort Worth, TX",
          "status": "scheduled",
          "emptySeats": "Availability"
        },
        {
          "classNumb": "001",
          "startDate": "6/4/2012",
          "endDate": "6/8/2012",
          "location": "McAlester, OK",
          "status": "scheduled",
          "emptySeats": "Availability"
        },
        {
          "classNumb": "920",
          "startDate": "6/18/2012",
          "endDate": "6/22/2012",
          "location": "Belle Chasse, LA",
          "status": "scheduled",
          "emptySeats": "Class Full"
        }
      ]}
]}

I must be doing something fundamentally wrong. so here is my code. In the end I am trying to build table rows out of each of the ‘sked’ objects. But I am having problems with getting individual data elements to show in the console. Here has been my attempts:

$('#content').on("click", "#catList tbody tr", function() {
                    var aData = oTable.fnGetData( this );
                    console.log( aData );
                    var scheduleData = aData.sked;
                    var catLink = 'catalog/' + aData.longDescript;
                    $('#fullDescript').load(catLink, function() {
                        if (!$('#fullDescript #offerings')) {
                            $('.enrollBTN').hide();
                        };

                        if ($(scheduleData).length > 0) {
                            $(scheduleData).each(function() {
                                for(var i = 0; i < scheduleData.length; i++) {
                                    /*var startDate = aData.sked.startDate[2];
                                    var endDate = aData.sked.endDate[3];
                                    var location = aData.sked.location[4];
                                    var classNumb = aData.sked.classNumb[1];
                                    var status = aData.sked.status[5];
                                    var emptySeats = aData.sked.emptySeats[6];*/
                                    //var item = scheduleData[i];
                                    console.log( aData.sked.startDate[2] );
                                    var html = "<tr>";
                                        html += "<td>" + item.classNumb + "<\/td>";
                                        //console.log( aData.sked[1].classNumb );
                                        /*html += "<td>" + scheduleData.endDate + "<\/td>";
                                        html += "<td>" + scheduleData.location + "<\/td>";
                                        html += "<td>" + scheduleData.classNumb + "<\/td>";
                                        html += "<td>" + scheduleData.status + "<\/td>";
                                        html += "<td>" + scheduleData.emptySeats + "<\/td>";*/
                                        html += "<\/tr>";
                                        //return scheduleData;
                                    };
                                $('#schedule tbody').append($(html));
                            });
                        };
                    });

                    $('#content').hide();
                    $('#fullDescript').show();
                });

Any help is 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-06-02T21:55:19+00:00Added an answer on June 2, 2026 at 9:55 pm

    It seems like you would only need the each or for loop, but not both. It also looks like there’s some confusion in there on whether to use item = scheduleData[i] or not. Try this:

    if ($(scheduleData).length > 0) {
        for(var i = 0; i < scheduleData.length; i++) {
            var item = scheduleData[i];
            var html = "<tr>";
            html += "<td>" + item.endDate + "</td>";
            // ... etc
            html += "</td>";
        }
    }
    

    Just as a PS, I’d recommend looking into a JS templating tool like Mustache.js. This would allow you to separate data from display template, so you could eliminate the parsing code. It would look something like this:

    var template = "{{#sked}}<tr><td>{{endDate}}</td><td>{{location}}</td></tr>{{/sked}}";
    var html = "<table>" + Mustache.render(template, aData) + "</table>";
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Rails newbie here, trying to get a new controller working. When I try to
I am a JSON newbie, but have good experience in PHP and javascript. The
I am a newbie trying to make a webservice that talks JSON. I have
Hi I'm a complete newbie to json. I'm trying to parse a json file
PostgreSQL / Django / newbie here. I've got a bunch of JSON data with
Here goes a newbie question: Create a new project in Xcode: File > New
I am newbie to ajax here and I know somebody would have encountered this
I'm a newbie in ASP.net MVC 3. I'm trying to do something trivial, but
I have a viewController showing some content. In header file, I defined an instance
Newbie here. I am trying to store the result of my search onto a

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.