Hello, If i have a JSON Object
var Obj = { col1 : 'data' };
the value 'col1' and 'data' are dynamically created.
Here i can access 'data' as Obj.col1. But want to read the value 'col1'.
How to do that?
Hello, If i have a JSON Object
var Obj = { col1 : 'data' };
the value 'col1' and 'data' are dynamically created.
Here i can access 'data' as Obj.col1. But want to read the value 'col1'.
How to do that?
Assuming your column name is available from the JavaScript:
var columnName = "col1";
alert(Obj[columnName]); // alerts "data"
If 'col1' isn't present in the object, it fails gracefully returning null
without raising an exception.
You may need to pass the the dynamic column name from serverside to clientside though. Something like:
var columnName = "<% columnName %>";