It working fine with hardcode of javascript array of cities. However, when I change javascript array cities to my javaSevlet code. That is the line $('#location').autocomplete(cities,{ becomes $('#location').autocomplete(http://localhost:8080/mywebapp/ListCityServlet,{.
In my ListCityServlet.java, in doPost(), I just write out the list of string like this:
PrintWriter out = response.getWriter();
out.write( cities );
When I entered any single charater, for example "m" on the <input type="text" id="location"/>. It displays whole string below in the autocomplete window ['Paris', 'New York', 'Milan', 'Stockholm', 'Melbourne', 'Montreal', 'Mexico', 'Los Angeles', 'San Francisco', 'London', 'Dubai', 'Madrid', 'Tokyo', 'Hong Kong', 'Sydney']
instead of a list of columns of Milan, Melbourne, Montreal.
I understand that my javaservlet the right String since I do not know what kind of right format of String my javaservlet code must return.
Please help
Thanks a lot for any of your comments and advices,
Bookmarks