M
Mark Smith
Hi,
I am trying to build a json object from a predefined variable. But the
variable name is being interpreted as a literal string rather than the
contents of the variable.
For example the following code displays "NONE" rather than the
contents of the variable "_nothingselected_":
<script>
var NONE="_nothingselected_";
var jsonOptions={ NONE : "Please Select" };
for(index in jsonOptions)
{
alert(index);
}
</script>
What is the correct way to do this?
Thanks
I am trying to build a json object from a predefined variable. But the
variable name is being interpreted as a literal string rather than the
contents of the variable.
For example the following code displays "NONE" rather than the
contents of the variable "_nothingselected_":
<script>
var NONE="_nothingselected_";
var jsonOptions={ NONE : "Please Select" };
for(index in jsonOptions)
{
alert(index);
}
</script>
What is the correct way to do this?
Thanks