# Any word yet?

**URL:** <https://www.ruby-forum.com/t/any-word-yet/83895>\
**Category:** Ruby\
**Created:** [January 30, 2007, 6:15pm UTC](https://www.ruby-forum.com/t/any-word-yet/83895 "2007-01-30T18:15:21Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![joep](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/87869e/32.png) [@joep](https://www.ruby-forum.com/u/joep)\
**Post date:** [January 30, 2007, 6:15pm UTC](https://www.ruby-forum.com/t/any-word-yet/83895/1 "2007-01-30T18:15:21Z")

</div>

Can anybody show me how to grab a parameter in ruby?

I have:

\<%  
require “dbi”  
require ‘cgi’  
cgi = CGI.new

year = cgi.params[‘year’]  
make = cgi.params[‘make’]  
category = cgi.params[‘category’]

%\>

for passing in from another form.

What I cannot get to work is:

How do I dereference a Javascript var?

Any input would be great!

Thanks

---

<div class="post-metadata">

**Author:** ![joep](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/87869e/32.png) [@joep](https://www.ruby-forum.com/u/joep)\
**Post date:** [January 30, 2007, 6:48pm UTC](https://www.ruby-forum.com/t/any-word-yet/83895/2 "2007-01-30T18:48:29Z")

</div>

On 1/30/07, joep [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> make = cgi.params[‘make’]  
> function someFunc(str\_string)
> 
> }
> 
> How do I dereference a Javascript var?
> 
> Any input would be great!
> 
> Thanks

Hi,

you’re mixing two things:

1. server-side ruby (i.e. it runs on server)
2. client side javascript (runs on client in browser)

The control flow is as follows:

1. server takes your page, runs the embedded ruby, and replaces it  
with the result.

xxx\<%= ‘a’ + ‘b’ %\>xxx is the same as xxxabxxx (except for possible  
newlines, but we don’t care now)

1. the page is sent to browser, and displayed. javascript is executed.  
now the page doesn’t contain any ruby code.

Your problem with js\_string is that there’s no javascript involved  
when ruby is run, and vice versa. What you have to do is to create a  
form and send the data back to the server for processing - see your  
year, make, category.

---

<div class="post-metadata">

**Author:** ![joep](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/87869e/32.png) [@joep](https://www.ruby-forum.com/u/joep)\
**Post date:** [September 25, 2007, 11:10pm UTC](https://www.ruby-forum.com/t/any-word-yet/83895/3 "2007-09-25T23:10:29Z")

</div>

On Jan 30, 11:27 am, “Jan S.” [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> > \<%  
> > for passing in from another form.
> 
> when ruby is run, and vice versa. What you have to do is to create a  
> form and send the data back to the server for processing - see your  
> year, make, category.- Hide quoted text – Show quoted text -

I gotcha.  
I’m still learning this stuff.  
Thanks for the direction.
