Check out this code.
<SELECT name="emp" id="EmployeeNames" >
</SELECT
<script>
var employees = { "accounting" : [ // accounting is an array in employees.
{ "firstName" : "Vikrant", // First element
"lastName" : "Korde",
"id" : 37461,
"age" : 29 },
{ "firstName" : "Arun", // Second Element
"lastName" : "Jadhav",
"id" : 37463,
"age" : 27 }
], // End "accounting" array.
"sales" : [ // Sales is another array in employees.
{ "firstName" : "Sachin", // First Element
"lastName" : "Deshpande",
"id" : 37462,
"age" : 35 },
{ "firstName" : "Sunil", // Second Element
"lastName" : "Chavan",
"id" : 37469,
"age" : 41 }
] // End "sales" Array.
} // End Employees
var selectObj = document.getElementById("E
selec
selectOb
</script>
Main Topics
Browse All Topics





by: MorcalavinPosted on 2009-06-24 at 07:09:43ID: 24701233
Depends on how your JSON is formatted/ Assuming you have just a simple array, the below should work. It would help if we had an example JSON string and which portion you are wanting to put in the select box.
Select allOpen in new window