# Passing variables

**URL:** <https://www.ruby-forum.com/t/passing-variables/187385>\
**Category:** Rails\
**Created:** [April 22, 2010, 12:59pm UTC](https://www.ruby-forum.com/t/passing-variables/187385 "2010-04-22T12:59:41Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![hemantborole](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/h/b782af/32.png) [@hemantborole](https://www.ruby-forum.com/u/hemantborole)\
**Post date:** [April 22, 2010, 12:59pm UTC](https://www.ruby-forum.com/t/passing-variables/187385/1 "2010-04-22T12:59:41Z")

</div>

Hello all,

I am trying to pass variables in Ajax.Request method. I can see that we  
can pass a single variable as:-  
new Ajax.Request(’/controller/action?id=" + value + “&status=JOINING’,  
{asynchronous:true, evalScripts:true, parameters:‘resume[comment]=’ +  
$F('resume\_comment” + forward\_value + “’)}); return false;”);

I hope that i am correct… Now i want to pass the value of another  
input… whose id is joining\_date1. And then i tried this way:-  
new Ajax.Request(’/controller/action?id=" + value + “&status=JOINING’,  
{asynchronous:true, evalScripts:true, parameters:‘resume[comment]=’ +  
$F('resume\_comment” + forward\_value + “’), ‘joining\_date=’ +  
$F('joining\_date” + forward\_value + “’)}); return false;”);

But now both of the variables are not passing… Can you guys give me  
some light that what i am missing here … ?

---

<div class="post-metadata">

**Author:** ![hemantborole](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/h/b782af/32.png) [@hemantborole](https://www.ruby-forum.com/u/hemantborole)\
**Post date:** [April 23, 2010, 9:15am UTC](https://www.ruby-forum.com/t/passing-variables/187385/2 "2010-04-23T09:15:29Z")

</div>

Hemant B. wrote:

> Hello all,

> But now both of the variables are not passing… Can you guys give me  
> some light that what i am missing here … ?

Anyone listening me… 🙂

---

<div class="post-metadata">

**Author:** ![hemantborole](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/h/b782af/32.png) [@hemantborole](https://www.ruby-forum.com/u/hemantborole)\
**Post date:** [April 23, 2010, 10:32am UTC](https://www.ruby-forum.com/t/passing-variables/187385/3 "2010-04-23T10:32:45Z")

</div>

This is Prototype, not Rails, which is probably the reason for the  
lack of responses.  
The API is here:  
[http://www.prototypejs.org/api/ajax/options](http://www.prototypejs.org/api/ajax/options)

My guess is that you need to replace the comma with a plus operator  
and prepend the second parameter with a &

new Ajax.Request(‘/controller/action?id=" + value + "&status=JOINING’,  
{asynchronous:true, evalScripts:true, parameters:‘resume[comment]=’ +  
$F(‘resume\_comment" + forward\_value + "’) + ‘&joining\_date=’ +  
$F(‘joining\_date" + forward\_value + "’)}); return false;");

---

<div class="post-metadata">

**Author:** ![hemantborole](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/h/b782af/32.png) [@hemantborole](https://www.ruby-forum.com/u/hemantborole)\
**Post date:** [April 23, 2010, 10:49am UTC](https://www.ruby-forum.com/t/passing-variables/187385/4 "2010-04-23T10:49:47Z")

</div>

Sharagoz wrote:

> This is Prototype, not Rails, which is probably the reason for the  
> lack of responses.  
> The API is here:  
> [Prototype API Documentation | Ajax Options (Deprecated URL)](http://www.prototypejs.org/api/ajax/options)
> 
> My guess is that you need to replace the comma with a plus operator  
> and prepend the second parameter with a &
> 
> new Ajax.Request(‘/controller/action?id=" + value + "&status=JOINING’,  
> {asynchronous:true, evalScripts:true, parameters:‘resume[comment]=’ +  
> $F(‘resume\_comment" + forward\_value + "’) + ‘&joining\_date=’ +  
> $F(‘joining\_date" + forward\_value + "’)}); return false;");

Ohh… yeah yeah… you are correct… That was the thing i was missing…  
Thanks with a big smile… 🙂
