If I use below line, I get output='1'.
But instead of giving hardcoded ID, Is there any way to pass by variable?
I already tried like:
var array=["ID","Title"]; data.d.results[i].array;
Got error: undefined.
The ID is an object property, so you need to access it like an object property using the square bracket notation instead of dot notation:
var array = ["ID", "Title"]; data.d.results[i][array];
Using the bracket notation, JS will translate
[ID] which is equal to
.ID (notice the dot). Using the dot notation, JS expects
array to be an object property, which is not.