jquery ui autocomplete bugs - i can't make it work with json
By following the example of binaryhowl I've tried to make my autocomplete dynamic.
Source is here which should be of close resemblance (modified to fit the url I retrieve my info from).
lookup.php returns json compliant (UTF8) results as per (plaintext):
["value1","value2","value3","value4","val开发者_StackOverflow社区ue5"]
If I provide a hardcoded version of the url for source:
source: "lookup.php?type=some_case&value=search_term"
The autocomplete list of suggestions is piled up as expected.
Lookup.php supports
application/json; charset=utf-8
And I get the following bugs from jquery:
Uncaught TypeError: Object [object Object] has no method 'menu' jquery-1.5.1.js:869 Uncaught TypeError: Cannot read property 'element' of undefined jquery.ui.autocomplete.js:337 Uncaught TypeError: Cannot read property 'd' of null jquery-1.5.1.js:869
As seen here:
All js scripts are directly from here and here, etc.
I would recommend against picking and choosing jQueryUI components from the github repository you linked to. This error, for example:
Uncaught TypeError: Object [object Object] has no method 'menu' jquery-1.5.1.js:869 Uncaught TypeError: Cannot read property 'element' of undefined jquery.ui.autocomplete.js:337 Uncaught TypeError: Cannot read property 'd' of null jquery-1.5.1.js:869
Is because the autocomplete widget is trying to use the menu
widget (an internal widget that is used by autocomplete).
I would recommend downloading the widgets you need using jQueryUI's download page, which will download the necessary files for the widgets you choose, or if you're using most of them, use jQueryUI hosted on a CDN.
精彩评论