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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T04:33:06+00:00 2026-05-28T04:33:06+00:00

The following is returning ‘undefined’ as the value for each item. Can someone show

  • 0

The following is returning ‘undefined’ as the value for each item. Can someone show me why?

Jquery

    $("button").click(function () {
    var estimateID = this.id;
    var baseURL = "/Dashboard/EstimateDetails/";
    var url = baseURL + estimateID;
    $.getJSON(url, function (data) {
        for (var i = 0; i <= data.details.length; i++) {
            $('#Details').html("<p>item1=" + data.details.Dma + " item2=" + data.details.Callsign + " item3=" + data.details.Description + "</p>");
        }
    });

JSON

{
    "details": [{
        "Dma": "Albany-Schenectady-Troy",
        "CallSign": "WRGB",
        "Description": "WRGB (CBS) Schenectady"
    }, {
        "Dma": "Albany-Schenectady-Troy",
        "CallSign": "WTEN",
        "Description": "WTEN (ABC) Albany "
    }, {
        "Dma": "Albany-Schenectady-Troy",
        "CallSign": "WXXA",
        "Description": "WXXA (Fox) Albany "
    }, {
        "Dma": "Atlanta",
        "CallSign": "WGCL",
        "Description": "WGCL (CBS) Atlanta "
    }, {
        "Dma": "Atlanta",
        "CallSign": "WXIA",
        "Description": "WXIA (NBC) Atlanta "
    }, {
        "Dma": "Austin",
        "CallSign": "KXAN",
        "Description": "KXAN (NBC) Austin "
    }, {
        "Dma": "Austin",
        "CallSign": "KVUE",
        "Description": "KVUE (ABC) Austin "
    }, {
        "Dma": "Baltimore",
        "CallSign": "WMAR",
        "Description": "WMAR (ABC) Baltimore "
    }, {
        "Dma": "Baltimore",
        "CallSign": "WBAL",
        "Description": "WBAL (NBC) Baltimore"
    }, {
        "Dma": "Baltimore",
        "CallSign": "WJZ ",
        "Description": "WJZ  (CBS) Baltimore "
    }, {
        "Dma": "Baltimore",
        "CallSign": "WBFF",
        "Description": "WBFF (Fox) Baltimore "
    }]
}

EDIT – the result when I run the above code is a single line of HTML added to the details div as follows:

item1=undefined item2=undefined item3=undefined

  • 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-28T04:33:07+00:00Added an answer on May 28, 2026 at 4:33 am

    data.details.Callsign is wrong

    data.details[i].Callsign

    is what you want, i.e. you are missing the array index as you loop over details. Notice you are doing that for multiple variables.

    Cleaner code might help. Separating the variables out like so is a good start…

     $.getJSON(url, function (data) {
         var details = data.details,
             dma, callSign,...; // and the rest of whatever you need
    
         for (var i = 0; i <= details.length; i++) {
             dma      = details[i].Dma;
             callSign = details[i].Callsign;
             // more here
    
             $('#Details').html("<p>item1=" + dma + " item2=" + callSign + ...
         }            
     });
    

    Is much more readable, and less error prone IMHO.

    EDIT — as pointed out in comments, html will overwrite the content of your div each time in the loop. You probably want append instead.

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

Sidebar

Related Questions

In writing a django app, I am returning the following json on a jQuery
This has to be a Jquery question. The following code is returning zero. When
I don't understand Why t he following function returning Nothing Public Function generatsTOC(ByRef doc
Can anyone help explain to me why the following is returning duplicate data? <?php
I have a function returning an array: function foo(){ return array('foo'=>1,'bar'=>2); } Can I
Could someone explain why pow() in the following code is returning a 0 when
I am using jQuery and have server code returning the following values 0:SELECT ONE;1:VALUE1;2:VALUE2
I have the following function and its always returning false. It does not even
The following code is returning an expression unused warning on the assignment operation in
I'm calling a web service and returning the following data in JSON format: [{OrderNumber:12345,CustomerId:555}]

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.