I need to dynamically build a select dropdown based on form data provided an ajax query. my DOM contains an element "organizations" with 4 children. The children with an org id and org name
Organizations = { { id="2", name="Systems"} { id="4", name="Network"} { id="5", name="Operations"} { id= "7", name="Security"} } I need to build the following select clause
<select name='organization'> <option value="2">Systems</option> <option value="4">Network</option> <option value="5">Operations</option> </select> How do I dynamically build the select statement?
Organizationstoorganizations.Organizationsisn't a valid JS object, that code should not work. It looks more like it should be an array which would start/end with[and], not{and}, and would require a comma between each item. If it is supposed to be an object it would require a label and a:to the left of each sub-object and a comma after all but the last sub-item.