javascript - jQueryUI Autocomplete doesn't show up when appending words to previous words -


in project, using jquery ui autocomplete plugin textfield. have written following code working fine:

<textarea id="result" rows="4" cols="50"></textarea> 

$('#result').autocomplete({     source: sugdata }); 

now explaining problem briefly:

if there words :

 go school  boy  play cricket 

then when type i in textfield, server respond go, am, play stored in sugdata variable. when start typing go after i(appending), autocomplete suggestion doesn't show suggestions fill. know happening because i go not equal data available in array stored in sugdata i.e go, am, play.

anyway solve issue?

ps: sending complete text in textfield server side necessary.

edit: if consider last word sent server, server respond i instead of go, am, play. so, not possible trim last word.

instead of static object, give source property function taking arguments request , response function.

  • work request.term source word.
  • filter sugdata , use result argument of response function invocation.

for more information on source being implemented function, please visit jquery ui documentation it.


Comments

Popular posts from this blog

Why does Ruby on Rails generate add a blank line to the end of a file? -

node.js - Bad Request - node js ajax post -

uitableview - Create and use custom prototype table cells in xamarin ios using storyboard -