I would do it as follows:

+ Set a jquery event on your select in some .js file:

$("#your_select_id").on("change", function(){
  $.ajax({
    url, data, etc... checj jquery docs
  });
});

I suggest .on() assuming you are using jquery 1.7. Alternatively you
can check .delegate() or .bind() if you are using older versions.

+ Controller:
def updating_action
  [...]
  respond_to do |format|
    format.js
  end
end

+ View updating_action.js:
Updating jquery and rails code such as

   $(id).val("<%=escape_javascript(@value)%>")

Check .val(), .replaceWith(), .text() and other similar jquery methods
to help you update your view.

Alternatively you can handle response on your ajax call, but I'm used
to do it like this, which seems to me easier and more flexible. Maybe
someone else can simplify it even more...

Anyway, hope it helps.

-- 
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 rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to