In my Ajax request the response data is an object like this:
how is possible to access value.
note: idVariable is a variable.
data.test1.idVariable.test2.value
Above code result is: undefined.
In my Ajax request the response data is an object like this:
how is possible to access value.
note: idVariable is a variable.
data.test1.idVariable.test2.value
Above code result is: undefined.
When you are using a variable to name a key in a javascript object you are supposed to use bracket notation. E.g:
var idVariable = 8;
var value = data.test1[idVariable].test2.value;
Otherwise, you are accessing a key names idVariable, instead of 8