2011-06-08 68 views
0

我在application.erb.html $alertdiv.text("some message");中有以下代碼,但我需要傳遞消息而不是硬編碼消息。我需要在通知中通過,所以我嘗試做這樣的事情$alertdiv.text(<%= notice %>);但沒有奏效如何連接javascript和rails 3

回答

1

你仍然需要包裹<%= %>標籤引號:

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