0

I understand autocomplete works like bellow:

  1. Get all list on script in advance
  2. Search item every time the input text changes

I don't like how this works, because the whole list exist on script so anyone can see the list using web browser's Dev Tool.

I'm wondering if there's a way to querying for every typing instead of having all list on script in advance.

Here's how I expect it to work:

  1. Query every time the input text changes
  2. Get the result on script.

It does not matter if the queries slow down the web site,

because the list would be not that large and security is more important here.

Any comments will be appreciated. Thanks.

Roshana Pitigala
  • 8,437
  • 8
  • 49
  • 80
qumm
  • 137
  • 1
  • 13

1 Answers1

1

Use ajax.

  1. Create a servlet which returns the html code you need.
  2. Send an Ajax request to the servlet.
  3. Assign the response text to the element.

Read more,

Roshana Pitigala
  • 8,437
  • 8
  • 49
  • 80