2
您好我一直停留在以下問題了天,我只是不知道怎麼回事錯了...的Rails的form_tag需要刷新
我有我的局部視圖,其中顯示了以下的form_tag代碼遠離主視圖添加到購物車:
<tr>
<% form_tag line_item, :method => :put do %>
<td><%= line_item.product.title %></td>
<td class="item_price" ><%= number_to_currency(line_item.total_price) %></td>
<td>
<%= text_field :line_item, :quantity, :size => 1, :value => line_item.quantity %>
<%= submit_tag 'update' %>
</td>
<% end %>
<td>
<%= button_to 'Delete Line Item', line_item, :method => :delete, :remote => true %>
</td>
</tr>
現在當我點擊添加到購物車,上面是在我有replace.html功能針對的ID渲染,但...
我可以實際上,使用更新按鈕更新購物車,除非我刷新頁面!我不知道這件事是什麼,它讓我生氣了!
有沒有人有任何想法我可能做錯了什麼?
你的控制器是什麼樣的?它應該通過渲染一些JS來做出響應,或者返回一些你的頁面上的某些JS可以採取行動來做你想做的事情 – 2011-04-15 17:56:13