Frederick Cheung wrote:
> On Nov 8, 3:36�pm, Nick S <[email protected]> wrote:
>> Basically, clicking the textarea "chatbox" will add a line with the
>> current time, and unfortunately, every click on the textarea results
>> in the identical line being written, which is the time that the page
>> was loaded.
> 
> That's completely normal - At the point that the template is rendered
> all of your <%= are evaluated - if you look at the source in the
> browser you won't see any of your ruby code (and even if you could,
> what's your browser supposed to do with ruby). If you need some ruby
> code evaluated you need to make a request to the server

But in this case, you probably don't need a server request -- I think 
JavaScript has an equivalent to Time.now.

In any case, I would advise against using ERb in JavaScript...

> 
> Fred

Best,
--
Marnen Laibow-Koser
http://www.marnen.org
[email protected]
-- 
Posted via http://www.ruby-forum.com/.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to