I have an ajax routine that returns data from an external source that is json encoded. The returned data is in a structure that includes an id value. I know what the expected id value is and store that in idVal. But I need to add this to the json data structure to obtain the content I want.
The following syntax is invalid but should make clear what I'm trying to do. Let's say that idVal is equal to 14:
$.ajax({
url: theUrl,
dataType: "json",
success: function(results) {
var data=results.content.id_[idVal].item;
...
So how do I reference "results.content.id_14.item" dynamically ?