0

I am trying to build this search feature where as user types in a text box i query the server and bring suggestions and show it as a list of options to chose from.

Also multiple selections is expected. Like when we type in the to box of gmail it gives us multiple options we select one than we can start typing again and it will show more options related to the new entry.

The server responds in a json format as

{
"success": "true",
"suggestions": [
    "abc",
    "abd"
]}

I tried using this plugin but the response from server is expected here in a complicated format (which includes image link etc). so it didn't work out.

https://github.com/guille/TextboxList

I tried using some other plugins also but most of them dont have the feature to query the database.

I know that almost all major websites have this feature so there has be a good optimized way to do this. Can you please tell me how to get this done.

Satpal
  • 132,252
  • 13
  • 159
  • 168
Vikash Singh
  • 13,213
  • 8
  • 40
  • 70
  • AJAX in [JQuery UI autocomplete](http://jqueryui.com/autocomplete/) will suite the bill. Here is a good example [How to use source: function()… and AJAX in JQuery UI autocomplete](http://stackoverflow.com/questions/21385892/how-to-use-source-function-and-ajax-in-jquery-ui-autocomplete) – Satpal Dec 30 '14 at 07:52
  • does it support multi-select ? – Vikash Singh Dec 30 '14 at 09:35

2 Answers2

1

Check Select2 Api demo with Loading Remote Data heading at http://ivaynberg.github.io/select2/

just change normal <select> to <select multiple="multiple">

Dev
  • 6,628
  • 2
  • 25
  • 34
0

Please see this jquery UI component this may serve your purpose Jquery AutoComplete Remote