Passing variables

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 .. ?

Hemant Bhargava 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.. :slight_smile:

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

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;");

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)

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.. :slight_smile: