I think the issue here is that you're trying to use coffeescript inside a script tag.
My recommendation would be to put this inside a coffee file or translate to plain javascript. My best, Ian 2014-05-04 3:24 GMT+09:00 Alfredo Barrero <[email protected]>: > Hi all, > > I'm starting with Ajax but I have a issue, should be a noobie issue but it > makes me crazy hehe. Could anyone tell me what's going on?. > > I'm following this guide > http://guides.rubyonrails.org/working_with_javascript_in_rails.html, and > with the following code my application does not recognize the action. > > > <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" " > http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> > <html> > <head> > <title>Hola Mundo con AJAX, version 2</title> > > <script> > > paintIt = (element, backgroundColor, textColor) -> *SHOW > ERROS LIKE 'unresolved variable or type element'* > element.style.backgroundColor = backgroundColor > if textColor? > element.style.color = textColor > > </script> > > </head> > <body><a href="#" onclick="paintIt(this, '#990000')">Paint it > red</a></body> > </html> > > -- > You received this message because you are subscribed to the Google Groups > "Ruby on Rails: Talk" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To post to this group, send email to [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/rubyonrails-talk/3bac38e2-4346-4f15-b04e-0fa4ef945979%40googlegroups.com<https://groups.google.com/d/msgid/rubyonrails-talk/3bac38e2-4346-4f15-b04e-0fa4ef945979%40googlegroups.com?utm_medium=email&utm_source=footer> > . > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/CAHRDpXrTDsNL%2Bk7XT08jpQUvVLc8EaCweMq59XnmVZkC%3DVb-fA%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.

