Joshua,

You can't access that variable directly from jQuery because jQuery is
Javascript running in the browser and @phone_number_categories is Ruby
running on the server.  If you want to do all this on the client side then
you can save the categories into a Javascript variable that is in scope with
the jQuery code.  You can store them in an array or JSON object or an array
of JSON objects or what ever makes the most sense.

Anthony Crumley

On Thu, Apr 8, 2010 at 10:45 AM, Joshua Martin <josmar52...@gmail.com>wrote:

> I may be asking a very dumb question, but I thought it'd be worth the
> asking..
>
> I'm using JQuery to dynamically create some form fields for entering phone
> numbers... Basically just two fields.. One for the number, and a select
> field so that the user can choose whether it's a Home/Work/etc. number.
>
> My Phone Number Categories (Home/Work/etc.) are stored in the database...
> Is there any way for JQuery to access the @phone_number_categories Rails
> variable from within the JavaScript code to create the select?
>
> --
> _________________________________
>
> Joshua S. Martin
>
>
> CONFIDENTIALITY NOTE: This e-mail message, including any attachment(s),
> contains information that may be confidential, protected by the attorney
> client or other legal privileges, and or proprietary non public information.
> If you are not an intended recipient of this message or an authorized
> assistant to an intended recipient, please notify the sender by replying to
> this message and then delete it from your system. Use, dissemination,
> distribution, or reproduction of this message and or any of its attachments
> (if any) by unintended recipients is not authorized and may be unlawful.
>
> --
> 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-t...@googlegroups.com.
> To unsubscribe from this group, send email to
> rubyonrails-talk+unsubscr...@googlegroups.com<rubyonrails-talk%2bunsubscr...@googlegroups.com>
> .
> For more options, visit this group at
> http://groups.google.com/group/rubyonrails-talk?hl=en.
>

-- 
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-t...@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