【发布时间】:2012-10-31 01:01:26
【问题描述】:
问题:Ajax 未按应有的方式运行。
邮政索引:
<tr>
<td><%= post.name %></td>
<td><%= post.created_at.strftime("%Y/%m/%d, %I:%M%p") %></td>
<td><%= post.view %></td>
<td id="post_like_<%= post.id %>"><%= post.like %></td>
<td><%= link_to 'like', like_post_path(post), :remote => true %></td>
</tr>
like.js.erb:
$("#post_like_<%= post.id %>").html("<%= @post.like %>");
我只有在刷新页面后才能看到更改。 Ajax 无法正常工作,但我未能在上述代码中找到问题所在。
【问题讨论】:
标签: ruby-on-rails ajax html-table