erm. the ouput still isnt what is expected. The servlet that i call will output as "a,b,c,d" (exclude double quotes) here is the sample code:
$("#businessCity").autocomplete("OrganizationCityList?limit=10", { formatResult: function(row,position,total,searchTerm) { // server sends rows e.g., kelantan, kedah return row.toString().split(',')[0]; } , formatItem: function(row,position,total,searchTerm) { // server sends rows e.g., kelantan, kedah return row.toString().split(',')[0]; } , extraParams: { stateId: function() { return $("#businessState").val(); } } }); The output is that the autocomplete only show one data in the listing.but what i want is that it will show all data(separated by comma) from the servlet into each row in the autocomplete listing. Please advice. On Feb 4, 10:01 am, "thomas.confuse" <choejens...@gmail.com> wrote: > The solution the issue. > > formatItem: function(row,position,total,searchTerm) { > // server sends rows e.g. kelantan, kedah > return row.toString().split(',')[0]; > } > > On Feb 3, 10:33 pm, "thomas.confuse" <choejens...@gmail.com> wrote: > > > Hi, Eric. > > Thanks for the response. > > but i somehow kinda "bump" into the another way of getting it done. > > trial and error . :-) > > > Its done using formatline option in autocomplete. I will paste the > > code here very soon. > > > On Feb 3, 10:14 pm, Eric Garside <gars...@gmail.com> wrote: > > > > I'm not sure what kind of data autocomplete accepts, as I'm not > > > familiar with the plugin, but I assume an array of values will work. > > > > If your Javaservletis returning "a, b, c, d" as your valuestring, > > > call: > > > > var servletResponse = "a, b, c, d"; // Or however you get the value > > > servletResponse = servletResponse.split(', '); // Split on the > > > delimiter plus a space > > > alert(servletResponse); // [a, b, c, d]; > > > > On Feb 3, 5:13 am, "thomas.confuse" <choejens...@gmail.com> wrote: > > > > > Hi, all. > > > > i just started to use Jquery. i m using remote data to pass into > > > > jQuery widget, autocomplete. > > > > but the data from theservletis generated in this format a, b,c,.... > > > > how can i break the data from theservletto populate the > > > > autocomplete ? > > > > > Please advice.i m using java for theservletand the jsp page to for > > > > the form.