jaminben jaminben - 1 year ago 86
Javascript Question

Get single value from Json response

Possible Duplicate:

I have a nested data structure / JSON, how can I access a specific value?

My Json response looks like this:


How can I just retrieve the referenceid value? I've searched and searched... tried all sorts of things but I can only return a "undefined".



Forgot my other code:-

function populateFormData() {

var mxKey = $.now();

$.get("\\web\\php\\somesite\\phpData.php?mxKey" + mxKey, function(applicationData) {

console.log("Application Data: " + applicationData);

var jsonData = JSON.parse(applicationData);

console.log("Json Parse Data: " + jsonData);



Answer Source

like this:

var a = [{
  "referenceid": "999",
  "firstname": "Firstname",
  "middlename": "Middlename",
  "lastname": "Surname",
  "shortlisted": "0"

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download