Skip to content
Advertisement

search autocomplete ajax in laravel

I am using ajax for live searching, but the problem is that It is shown only one result

when I am using .html() but when I am using append() it works but every word i write it to duplicate the results,

here is my code:

in controller,

JavaScript

ajax code in blade

JavaScript

Advertisement

Answer

Yes you set your content in your loop statement, so it will only take the last content.

You can use some buffer variable :

JavaScript
User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement