I have a search Input box and I want display 5 similar phrases every time a user searches for a phrase?
for Example :
If the user searched for "ram" …
Return the following word system to me and display it
ram 4
ram 8
ram 16
rampal
…
What the best way would you suggest?
2
Answers
for the search use efcore and linq .Like(c.Name, "a%").take(5) or
.contains("a").take(5) and for working with ajax build an api that it’s get the
search word and return the json list and show it with ajax just search "show json list item with ajax in asp.net core"
I suggest you can use Autocomplete plugin in jQuery UI. Here is a simple demo you could follow:
Model:
View(Index.cshtml):
Controller:
Reference:
https://jqueryui.com/autocomplete/