Trouble getting dynamic values fed to my javascript

X

Xeno Campanoli

Say, I usually have .rhtml/eruby access to all my values, but I'm seeing this
weird case, possibly because I'm using https instead of http (I cannot think of
anything else) that doesn't allow the values from <%= $x %> to be utilized in
javascript methods. When I do the following:

<%
$x = $cgi['x']
puts "trace $x: #{$x}"
%>

<script type="text/javascript">checkX("<%= $x %>");</script>

in the source view from the browser it always shows:

<script type="text/javascript">checkX("")</script>

even though my logs show the line with "trace $x: value of x".

What gives? Is this a known or unexpected behavior? Is there a way I can get
around it?

I have tried it several ways, and I know I'm not mistaken.

Sincerely, Xeno
 
X

Xeno Campanoli

Xeno Campanoli wrote:

eruby --version gives me:

eRuby version 1.0.5
ruby 1.8.6 (2007-09-24 patchlevel 111) [i486-linux]
----snip---
 
X

Xeno Campanoli

This is kindof a followup of my other email about javascript in my .rhtml files
(eruby with https apache2). What I seem to be generally seeing is that anything
that is not the initial behavior in eruby values that by necessity must be set
outside any blocks in the early <% %> stanza.

If this is known stuff, forgive me. I just need a link, or perhaps a
recommendation to do it another way. I know AJAX goes in Rails, so it must go
here too, right?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,174
Messages
2,570,940
Members
47,484
Latest member
JackRichard

Latest Threads

Top