[JQueryUI] Autocomplete with JSON: API documentation contains error in example
Hi all,
spent an afternoon yesterday to try to get autocomplete to work, with a Java servlet as source.
I used the JSON example from the API documentation:
http://api.jqueryui.com/autocomplete/#option-source
It states you can use the following JSON for example:
[ { label: "Choice1", value: "value1" } ]
I tried it out and my autocomplete script didn't work; firebug didn't find JavaScript errors, so I was at a loss as to what was wrong...
Finally I found out in a stackoverflow.com post that this example actually isn't well formed JSON, and doesn't work!
It should read:
[
{
"label": "Choice1",
"value": "Value1"
}
,
{
"label": "Choice2",
"value": "Value2"
}
- ]
When not sure if your JSON is valid, you can run it through this site: http://jsonlint.com/