How do you get a list of all projects from a model such as Project.all and all the project.name’s in there moved to a listed in javascript which is then printed out using Jquery UI Autocomplete
Link to Jquery UI Autocomplete
$( " #tags " ).autocomplete({
source: function(request, response){
//pass request to server
$.ajax({
url: "/projects/project_list",
dataType: "json",
data: {
style: "full",
maxRows: 12,
term: request.term
},
minLength: 1,
select: function( event , ui ) {
log( ui.item ?
ui.item.value : + this.value );
}
});
Think you are probably looking for something like this:
You then need to call this method from inside the js
Here’s a relatively complete example of some that produces an autocomplete list of airports
And here’s the associated controller code:
`