我正在开发一个电子商务网站..现在我被卡住了..当我提交表单时,它不会在第一次点击时提交,我需要再次点击才能让它工作.. . 我已经使用锚标签提交我的数据bcoz我想显示thickbox(iframe)内的数据......
View file
<%= form_for :order, :url => populate_orders_url ,:html => { :class => "data# product.id}"},:method => "post",:remote => true do |f| %>
// data
//submit button
<a href="/cart?KeepThis=true&TB_iframe=true&height=380&width=1000&modal=false" onclick="$('.data<%= product.id %>').submit().trigger.reload();" class="thickbox cart_button"></a>
orders controller.rb
def populate
@order = current_order(true)
params[:products].each do |product_id,variant_id|
quantity = params[:quantity].to_i if !params[:quantity].is_a?(Hash)
quantity = params[:quantity][variant_id].to_i if params[:quantity].is_a?(Hash)
@order.add_variant(Variant.find(variant_id), quantity, ad_hoc_option_value_ids, product_customizations) if quantity > 0
end if params[:products]
params[:variants].each do |variant_id, quantity|
quantity = quantity.to_i
@order.add_variant(Variant.find(variant_id), quantity, ad_hoc_option_value_ids, product_customizations) if quantity > 0
end if params[:variants]
fire_event('spree.cart.add')
fire_event('spree.order.contents_changed')
redirect_to cart
end
我在萤火虫中看到并处理了填充方法,但它没有将数据发送到购物车,它显示我的购物车是空的......并且购物车正在处理......