$('#tags').autocomplete({
params: {search_type:$('#search-type').val()},
minChars: 2,
appendTo: $(".cash-collection-select"),
serviceUrl: '/admin/journals/search_roles',
onSelect: function (suggestion) {
$("#q").val(suggestion.data);
console.log(suggestion.data)
alert("You selected: ' + suggestion.value + ', ' + suggestion.data")
},
onSearchStart: function(query) {
console.log("query: "+query)
},
onSearchComplete: function (query, suggestions) {
console.log(suggestions.data)
}
});
I am getting the error Cannot read property 'replace' of undefined. My response from the rails action is coming in json format
suggestions = User.where("email LIKE ?","#{params[:query]}%")
message = {:query => "Unit", :suggestions => suggestions}
render :json => message
this is my input #tags
<input class="search-emails" type="email" id="tags" placeholder="Search by email.." />
Aucun commentaire:
Enregistrer un commentaire