Get back a Javascript variable

Hi,

I ve performed some search but i don t really find what i want to do…
So it s simple, i need to get back in a controller or a view a
Javascript variable (which i use to detect the version of a flash
player)…

How can i dot that ?

thank you for helping

Guillaume.

Hi,

Do this by making this call in the section of your .rhtml page.
<%= javascript_include_tag “Name Of Javascript” %>

I thik this will resolve your problem.

Julio

On 5/7/07, Guillaume [email protected] wrote:

thank you for helping

Guillaume.


Posted via http://www.ruby-forum.com/.


abracos,

Julio Cesar

Thanks for your help,
but i already included that… my problem is to return the Javascript
variable in a ruby variable…

Cause Javascript is executed on Client side, so i don t see how to get
back the content of that variable later in the ruby code

I hope to be clear…

thanks

Julio Cesar wrote:

Hi,

Do this by making this call in the section of your .rhtml page.
<%= javascript_include_tag “Name Of Javascript” %>

I thik this will resolve your problem.

Julio

On 5/7/07, Guillaume [email protected] wrote:

thank you for helping

Guillaume.


Posted via http://www.ruby-forum.com/.


abracos,

Julio Cesar

Maybe you should include some more context regarding your problem.
There are many ways to send client information to the server…you
could send this along as part of a form POST, or in the query part of a
URL, or using XMLHttpRequest, or…

Guillaume wrote:

Thanks for your help,
but i already included that… my problem is to return the Javascript
variable in a ruby variable…

Cause Javascript is executed on Client side, so i don t see how to get
back the content of that variable later in the ruby code

I hope to be clear…

thanks

On May 7, 2007, at 10:36 PM, Guillaume wrote:

Thanks for your help,
but i already included that… my problem is to return the Javascript
variable in a ruby variable…

Cause Javascript is executed on Client side, so i don t see how to get
back the content of that variable later in the ruby code

You have to send it back somehow. A hidden field in a form, a
parameter in the URL, Ajax, …

You’ll typically write JavaScript code to hook into the new request
to add the value of the variable when the request starts. For
instance, if there’s a form some code in onsubmit sets the hidden
field to the value of the variable at that moment. You see the idea.

– fxn

So there it is…

I ve got some javascript in a view (a part of the view code)… this
javascript has a variable TOTO…
At the end of the javascript execution in the view, this variable TOTO
contain information that i need later…

So to use this information later, i need to put the content of the
Javascript variable TOTO in a new ruby variable…

how do you do that ?

thanks again

Guest wrote:

Maybe you should include some more context regarding your problem.
There are many ways to send client information to the server…you
could send this along as part of a form POST, or in the query part of a
URL, or using XMLHttpRequest, or…

Guillaume wrote:

Thanks for your help,
but i already included that… my problem is to return the Javascript
variable in a ruby variable…

Cause Javascript is executed on Client side, so i don t see how to get
back the content of that variable later in the ruby code

I hope to be clear…

thanks

I think what other people have already said. Put your variable inside a
hidden text field or someplace else in the dom and then read it out of
it
with an AJAX call. There’s multiple possibilities for getting the value
with something like that.

On 5/8/07, Guillaume [email protected] wrote:

I ve got some javascript in a view (a part of the view code)… this


Posted via http://www.ruby-forum.com/.


Terry (TAD) Donaghe

You said multiple possibilty… could you give me a bit of more details,
so i will google it… i me quiet a newb on RoR, so…

Thank you…

Terry D. wrote:

I think what other people have already said. Put your variable inside a
hidden text field or someplace else in the dom and then read it out of
it
with an AJAX call. There’s multiple possibilities for getting the value
with something like that.

On 5/8/07, Guillaume [email protected] wrote:

I ve got some javascript in a view (a part of the view code)… this


Posted via http://www.ruby-forum.com/.


Terry (TAD) Donaghe
http://tadspot.tumblr.com

any idea ?

thank you…

Guillaume wrote:

So there it is…

I ve got some javascript in a view (a part of the view code)… this
javascript has a variable TOTO…
At the end of the javascript execution in the view, this variable TOTO
contain information that i need later…

So to use this information later, i need to put the content of the
Javascript variable TOTO in a new ruby variable…

how do you do that ?

thanks again

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs