I want to send an AJAX request once an option is selected (changed) from the select_tag in Rails 3.1. Can we use :remote=>true or :onchange => remote_function() or is there some other way ?
I want to send an AJAX request once an option is selected (changed) from
Share
You should definitely do this with jQuery (with an unobtrusive approach to keep things as clean as possible). On your .js file you should have something like this…
this is as simple as it should be if you just want to call a remote action on your controller (notice I passed the value of the selected option since you probably want that value to do something with it). If you need to do something after the ajax call is executed use the
succesoption. Hope this helps.