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.

http://en.wikipedia.org/wiki/Query_string#URL_encoding

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

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.

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