2013-03-14 82 views
0

我试图实现这个代码,当我运行我的本地服务器时,我得到一个语法错误。我正在运行Rails版本3.2.11,并认为这可能与该代码有关。Ajax语法错误

<h1>Time Ajax Demo</h1> 
<p><%= link_to 'Get Current Time', time_refresh_path, 
    remote: true %> 
</p> 
<p id='currentTime'> 
Current time will appear here 
</p> 

这是我的错误:

syntax error, unexpected ':', expecting ')' 
    remote: true);@output_buffer.safe_concat(' 
+1

您在使用Ruby 1.9的? – 2013-03-14 19:05:42

回答

0

我认为你正在使用红宝石1.8.X。如果您使用的Ruby版本低于1.9.X使用=>

<%= link_to 'Get Current Time', time_refresh_path, :remote => true %>