Hi..I would be happy to get some support.
What I want is: 1. a query field #type in some letters looking for a name 2. a dynamic updated list according to the typed-in letters
What I have:
#view <%= text_field_tag :query%>
<ul id='results'> <%@clients.each do |client|%> <li><%= client.name%></li> <%end%> </ul>
#controller def search @clients = Client.where("name like ?", "%#{params[:query]} %").limit(5) end
#coffee jQuery ($) -> $("#query").change -> $.get "search", (data) -> $("#results").html data
What is happing now is that it lists all names..and if I type in some letters and click return ..the whole page is getting rendered again..in the list
How code it right? Thanks