I am getting a JSON object using the following code:
// Check that the token has been updated, then submit the form as required
$.when( $.getJSON(url + 'scripts/json.php'), button).then(function(json, button) {
}
If I output the values in the console window as follows:
console.log(json);
I get the following:
[Object { token="cdad8422e88787958729e21cce102cb0"}, "success", Object { readyState=4, responseText="{"token":"cdad8422e88787958729e21cce102cb0"}", status=200, more...}]
But trying to get the value of ‘token’ using this:
console.log(json.token);
I get ‘undefined’
It’s an Array with Objects in it. You can access it via
json[0].token.