2013-03-14 85 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 %>