javascript - Ajax, selects and Ruby on Rails -
i have fields_for
select tags. want fill them dynamically. mean: choose country (ukraine in example) , select fills name of cities. so, decided make ajax. change 1 select's value calls onclick
function, uses ajax values (cities) controller , fill 2nd select them.
<%= f.fields_for :user |f_cond| %> <%= f_cond.select :country, countries %> #first <%= f_cond.select :city, cities %> #second
is choice or can make better?
and call model's method directly controller, or better make function in helper , call it?
Comments
Post a Comment