I have a simple drop down box on a page with the below code:
<p>
<%= f.label "Group" %><br />
<%= select("employee", "group_id", Group.all.collect {|p| [ p.name, p.id ] }, { :include_blank => true })%>
</p>
<div id="employees">
<!--this will be filled with ajax request-->
</div>
it shows Groups
to the user. What I'd like is to have a div next to this drop down that displays number of employees that belong to a group. I get this number by:
Groups.employees.count
but I don't know how this would work with ajax as everytime the drop down changes i'll have to go back to the server to get this number and then update the div.
I can use jQuery if need be.