Currently using the JQuery UI autocomplete list function JQuery UI – Autocomplete. I have a project model that contains the list of projects. I want to get the list of all projects and display it through the JQuery UI autocomplete list function
This is what I currently have in my application.js file.
$(function() {
function log( message ) {
$( "<div/>" ).text( message ).prependTo( "#log" );
}
var availableTags = [
"0407 Dave",
"0409 John" ,
"0503 Michael",
"0554 Jack",
"0886 Daniel",
"0969 Robert",
"0971 Steve",
"S006 Jack",
"S006t Andy"
];
$( " #tags " ).autocomplete({
source: availableTags
});
It can be seen that from the code above that it is displaying the list from the variable ‘avaliableTags’. But I don’t want this I want to be able to display projects from my project model
You should return the data from the project model as JSON data. Create a page to access the data in the project model and return JSON data, then change the source to that page URL.