2011-06-08 64 views
0

我在application.erb.html $alertdiv.text("some message");中有以下代码,但我需要传递消息而不是硬编码消息。我需要在通知中通过,所以我尝试做这样的事情$alertdiv.text(<%= notice %>);但没有奏效如何连接javascript和rails 3

回答

1

你仍然需要包裹<%= %>标签引号:

$alertdiv.text("<%= notice %>");