I'm trying to get the jquery autocomplete ui to work but without success. There is no list of matches presented. I'm getting the error "TypeError: this.source is not a function"
so far I have an input field <input type="text" id="searchbar" name="title" placeholder="Search">
and then in my script I have
I'm not getting this to work. anyone have any ideas of where I can begin to troubleshoot? I really have a hard time with the jquery ui documentation.
At first console.log your data to check is there any data returned from ajax request then remove double quote from your data variable.
source: "data"(wrong)
source: data(right)
wish it helps
You only have to use this code for your autocomplete:
$("#searchbar").autocomplete({
source: "php/searchbar.php",
minLength: 3
});
You don't have to do an extra ajax request. The plugin it self does the ajax request.
You have an missing hash in your autocomplete selector too:
$("searchbar") vs. $("#searchbar")
I have created a jsfiddle here: https://jsfiddle.net/9rtu412g/
Source from documentation here: https://jqueryui.com/autocomplete/#remote (view source)
For your jQuery version:
<script src="js/jquery-1.6.js" type="text/javascript"></script>
Use this jQuery UI version: https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.11.4/jquery-ui.min.js
I hope I could help you to solve your problem.