codeexploiter
05-07-2007, 04:48 AM
Hi,
Please have a look at the following code
function show() {
var columnHeaders = [
{key:"id_no"},
];
var keyValue = columnHeaders[0].key;
var JSONArray2 = [{keyvalue:"testing"}];
}
In the above function what I am trying to achieve is to create a JSON array that will be like the following
JSONArray2 = [{"id_no":"testing"}]
The question is how I can specify a key value using a variable name in which the original key value I want to use?
Now below code
var keyValue = columnHeaders[0].key;
var JSONArray2 = [{keyvalue:"testing"}];
gives the following
JSONArray2 = [{keyvalue:"testing"}]
Please help me to understand this problem
Regards
CodeExploiter
Please have a look at the following code
function show() {
var columnHeaders = [
{key:"id_no"},
];
var keyValue = columnHeaders[0].key;
var JSONArray2 = [{keyvalue:"testing"}];
}
In the above function what I am trying to achieve is to create a JSON array that will be like the following
JSONArray2 = [{"id_no":"testing"}]
The question is how I can specify a key value using a variable name in which the original key value I want to use?
Now below code
var keyValue = columnHeaders[0].key;
var JSONArray2 = [{keyvalue:"testing"}];
gives the following
JSONArray2 = [{keyvalue:"testing"}]
Please help me to understand this problem
Regards
CodeExploiter