How to realize the associative word function of the search box

does this function require front and rear cooperation? Or can it be completed as long as the front end?
the requirement is to fill in the project name. Multiple project names automatically appear in the box below. Click on the input box above, and the input box above completes the interface http://suggestion.baidu.com/su found on the
network, but the data called out by this interface ajax does not contain the project name we need

.

Thank you for giving me an answer. The first floor is more in line with my inner thoughts and my current technical level, so I adopted him. Thank you very much! Thank you! Thank you! Thank you!


before and after cooperation, you are no longer associated with

that link belongs to Baidu.

when the front end detects input onchange, it goes to the back end to query the matching string, and the back end returns you an array containing the results sorted by relevance

.

first:

  • the amount of data is very small so that all the data can be load to the client and then write the logic in the front end
  • backend cooperation is required when there is a large amount of data

secondly, the trie tree is used for the implementation of the word storage data structure, so that the fast retrieval can be carried out, and the back end is only responsible for searching according to the input. The front end listens to the input box and enters the content after the ajax is submitted to the backend for completion in a few milliseconds.

related references: twitter's js library typeahead.js

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b36c34-2c030.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b36c34-2c030.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?