I have a collection of data in a select box, let's say @users = User.all. On change, I would like to get a variable in javascript with the user that is selected, I mean something like this :
$("user_select").change(function(e){
e.preventDefault();
user_id = $(this).val();
user = <%= @user.find(<user_id>) %>
})
Is it possible? Or I have to put the whole collection in javascript variable and get it from there?