How to pass javascript variable to controller

i have a JavaScript variable and i need to pass that to controller
with the remote_function method.
how do i pass this?

nirosh wrote:

i have a JavaScript variable and i need to pass that to controller
with the remote_function method.
how do i pass this?

The same way you pass any parameters using HTTP. You can either put them
in the query string or in the form data of a POST request. Make sure you
encode them properly using URL encoding.

On 25 May 2010 03:29, nirosh [email protected] wrote:

how do i access the passing variable in controller. i have done the
passing variable part and when i use params[:variable_name] it gives
error

so could u please explain that a bit?

Look in the log to see what value is being passed in params, this will
tell you whether it is accessing the value that is the problem or
whether you are not getting into the params in the first place. If
the value does not appear in the log look at the html of the page
(View, Page Source or similar in the browser) and see whether the html
is what you expect. If that still looks ok try pasting the html into
the w3c online html validator to check the html is valid.

Colin

it says that params[:variable_name] is nil.i tried several ways. but
finally non of that working and gives the same nil output.

how do i access the passing variable in controller. i have done the
passing variable part and when i use params[:variable_name] it gives
error

so could u please explain that a bit?

nirosh

On 25 May 2010 15:18, nirosh [email protected] wrote:

it says that params[:variable_name] is nil.i tried several ways. but
finally non of that working and gives the same nil output.

You have snipped all the original message so it is not clear what this
is in response to. Are you replying to my suggestions? If so what
have you found for each of them?

Colin