Utilizing jQuery UI Autocomplete, I have encountered a situation where the documentation mentions that the source can consist of a list of JSON objects. The current code is functional; however, it lacks a root element for the list of JSON objects.
<script>
var availableTags = [];
function populate() {
var availableTags = [
{ label:"ActionScript", value: "1"},
{ label:"AppleScript", value: "2"},
{ label:"Asp", value: "3"}
];
$( "#tags" ).autocomplete({
source: availableTags
});
};
</script>
I am seeking guidance on how to effectively iterate over this list of objects to extract the values of "label" and "value," given the absence of a root element. Any pointers or suggestions on how to accomplish this task would be greatly appreciated as my attempts at implementing loops have not been successful.
Thank you in advance for your assistance. JW