【发布时间】:2012-03-04 18:59:44
【问题描述】:
我正在尝试将数据加载到模式弹出窗口中。
在我的 Post 模型中,我有一个标题和一个描述。
我希望标题出现在表格中,并在单击模式时显示其中的描述文本。
(下面是表格的代码,带有索引和帖子的标题以及打开模式的链接。)
<% @posts.each_with_index do |post, index| %>
<tr>
<td><%= index + 1 %></td>
<td><%= post.title %></td>
<td>Link-to-display-modal-goes-here</td>
</tr>
<% end %>
我有一个隐藏的 div,我可以通过单击按钮使其出现/消失。我只是不知道如何填充 div。
下面是我要加载帖子描述的 div。
<div id="myModal" class="modal hide fade">
post's description goes here.
</div>
非常感谢任何帮助。
【问题讨论】:
标签: ruby-on-rails twitter-bootstrap