Reputation: 27789
I'm using the plugin by Drew Wilon to search a DB table of city names when the user starts typing to a text field. Via Firebug I can see that data is returned in proper JSON format. So AFAIK everything is working ok on the PHP end.
When results are returned, they should be displayed in a div below the textfield. I can see this div in Firebug but it remains empty. It used to work fine so I'm thinking it's a small gotcha that I'm just not seeing.
How can I get the results to display in this div?
Test page is here - in the middle column is a City field. Type for example "ham" and you'll see the returned data in JSON format in Firebug.
JS:
$("input#city").autoSuggest("http://sub.domain.com/survey/search_city", {
selectedItemProp: "response",
selectedValuesProp: "id",
searchObjProps: "response",
startText: "",
minChars: 2,
selectionLimit: 1,
});
Returned JSON sample
[{"response":"Hamilton (Victoria, Australia)","id":"18860_14"},{"response":"Hamilton (Hamilton Municipality, Bermuda)","id":"6042_27"},{"response":"Hamilton (Ontario, Canada)","id":"3460_43"},{"response":"Hami (Xinjiang, China)","id":"6156_49"},
Upvotes: 2
Views: 222
Reputation: 991
The only thing i could see would be
$("input#city").autoSuggest("http://kms.rubypseudo.com/survey/search_city", {
selectedItemProp: "response",
selectedValuesProp: "id",
searchObjProps: "response",
startText: "",
minChars: 2,
selectionLimit: 1,
});
got a Comma after "selectionLimit: 1" and it should not.
that would break your parameter json therefor break the plugin
i checked it out again and realized that there is an incompatibility with the autoSuggest and the jquery.validate.js plugin ... if you remove it your autocomplete will work . it got something to do with the $.getJSON... never completing when you got both addon
Upvotes: 1