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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T17:14:20+00:00 2026-06-04T17:14:20+00:00

I have the following JS code: var response = loadXMLDoc(); var dataset = response.data;

  • 0

I have the following JS code:

var response = loadXMLDoc();
var dataset = response.data;
alert(response);
alert (dataset);

“alert(response)” prints this:

{"labels":["-inf - 10","10 - 20","20 - 30","30 - 40","40 - 50","50 - 60","60 - 70","70 - 80","80 - 90","90 - 100","100 - 110","110 - 120","120 - 130","130 - 140","140 - 150","150 - 160","160 - +inf"],"data":[3,8,7,3,7,6,6,7,5,4,10,7,4,4,7,2,0],"count":16}   

while “alert(dataset)” gives “undefined”. I have tried to use

     var dataset = response["data"]; 

but it did not work as well. I want to get the data array from the JSON object. How can i do that.
Thanks

  • 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-04T17:14:21+00:00Added an answer on June 4, 2026 at 5:14 pm

    Seeing that you got alert to show response, it’s a string, not yet an object.

    You need to parse it with JSON.parse()

    //load your response
    var response = loadXMLDoc(),
        dataset;
    
    //parse response
    response = JSON.parse(response);
    
    //assign data to dataset
    dataset = response.data;
    
    //Hit F12 to see the console
    console.log(response);
    console.log(dataset);
    

    ​
    Here’s a sample

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

Sidebar

Related Questions

I have this following code $(function () { $.post(fetch_data.php?url=+$('#url').val(), { }, function(response){ var arrValues
So I have the following code: $(document).on('click', 'a[data-link]', function () { var $this =
I have the following code: foreach (var control in this.Controls) { } I want
I have the following code: var XmlDoc = new XmlDocument(); Console.WriteLine(); Console.WriteLine(response.ReadToEnd()); Console.WriteLine(); //
i have the following code: foreach (var str in usedCSS) { if (CSS.Contains(str)) Response.Write(str);
I have the following code: var acOptions = { source:function (request, response) { $.ajax({
I have the following code $(function() { $('.apply').click(function(e) { var z = $(this).attr('z-id'); var
i have the following code: var request = (HttpWebRequest)HttpWebRequest.Create(url); var response = request.GetResponse(); var
ok i have this following code that parses JSON from an ajax response using
I have the following code: var sl: THashedStringList; begin sl:= THashedStringList.Create; sl.Duplicates := dupIgnore;

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.