Autocomplete Textbox results based from SQL database

前端 未结 5 996
情深已故
情深已故 2020-12-16 06:16

I\'m trying to create an auto-complete function into a textbox but the result should come from my SQL database.

Here\'s the code that i\'m trying to configure:
<

5条回答
  •  暗喜
    暗喜 (楼主)
    2020-12-16 06:42

    Just a suggestion for the autocomplete file. Sorry, I would have added a comment above, but I don't have enough rep as of writing this.

    After successfully implementing Useless Code's suggestion I was noticing my server overhead was going through the roof. It seemed bots were some how initiating the script, even though there was no letters being typed in the input area. I did a little test on the autocomplete file and found it would query my database even if the term was empty.

    So, I just encpsulated the whole autocomplete script with an if statement... like so...

    
    

    ... and now my server is back to normal.

提交回复
热议问题