Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

102
Views
Getting data from JSON with arrays

I am getting a little stuck with this one. I am trying to use jquery on my website to change an element. Without using an array of data in JSON, it works fine but soon as I use an array of data in there, it stops working. I have tried multiple searches online and tested around myself but I can't seem to get it to work. Surely it should be as simple as below? (I am passing data into this so the server can get commands back if you wondered what the x is for. This bit works fine.)

The following is simple version of the JSON data I am working with:

{"OUTPUTA":"TRUE","OUTPUTB":"TRUE"},{"OUTPUTC":"FULSE","OUTPUTD":"TRUE"}

Script used:

function update(x) {
$.getJSON('/_ConfigJSON', {
    buttondata: x,
}, function (data) {
        $("#BUTTONA").text(data.[1][OUTPUTA]);
        }
  });
}

Working version (without array data):
"OUTPUTA":"TRUE","OUTPUTB":"TRUE","OUTPUTC":"FULSE","OUTPUTD":"TRUE"

Script used:

function update(x) {
$.getJSON('/_ConfigJSON', {
    buttondata: x,
}, function (data) {
        $("#BUTTONA").text(data.OUTPUTA);
        }
  });
}
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Your code is syntactically incorrect.

Here's the updated code:

function update(x) {
$.getJSON('/_ConfigJSON', {
    buttondata: x,
}, function (data) {
        // Gets the second element.
        $("#BUTTONA").text(data[1]["OUTPUTA"]);
        }
  });
}
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!