0
<input type="number" size="4" class="input-text qty text" id="qty" value="<%= item.quantity.to_i %>" min="0" step="1" style="width:50px;">
<%= link_to "+", { :controller => "orders", :action => "increase_item_quantity", :id => item.id, :amount => '$('qty').value' }, class: "ui button", style: "background-color:#2B4B6F;color:white;font-weight:bold;" %>
我有一个link_to,我需要传递div id“qty”的值,并且在这样做时遇到了麻烦。我的代码显然不好。我怎样才能将额外的参数传递给链接?在link_to传递2个div的值
这没有奏效。我的URL最终是这样的:http:// localhost:3000/increase_item_quantity?id = 2所以金额仍然没有被传入 – sump
@sump使用'window.location = url +'&amount ='+ qty'那么 – dimakura
是我有id集。但它仍然没有工作。 – sump