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
--
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.