Topic: Get value from drop-down list

I have a drop-down list where you can select a person.

<%= select_tag "person", options_from_collection_for_select(Person.all, :id, :name, 1) %>


When a person is selected I want to display that persons phone number. How can I do that?

After looking at a lot of solutions of how to use Javascript/jQuery/CoffeeScript in RoR I´m a bit confused over what to place in which files and what to use. Can someone please give me a simple example?

Re: Get value from drop-down list

It's a little different but I posted a question that this is a part of.

http://railsforum.com/viewtopic.php?pid=162085#p162085

The java script does get the value out of the select. However, your going to have to call the javascript function differently as I'm using a button to take the value out of the select

Re: Get value from drop-down list

and in my authors controller I have the following defined to get the full name of the author

    def full_name
    @author = Author.find(params[:id])
    render :json => [@author.last_name + " " + @author.first_name]
    end