【发布时间】:2016-03-18 06:30:23
【问题描述】:
您好,我在视图中包含了给定的代码
= form_for @order, :url => update_express_shipping_path,:remote=> true, :html => { :id => "shippingDetails" } do |form|
= form.radio_button :express_shipping, true, :value => true, :id => 'shipping_method4', :name => 'shipping_method'
Express Shipping
.checkOrder{:value=> @order.id}
并在我的 js 文件中包含
$('#shipping_method4').click(function(){
if($(this).is(':checked')){
alert ('123')
$.ajax({
url: '/update_express_shipping',
type: 'POST',
data: {
'id': $('.checkOrder').attr('value'),
'express_shipping': $(this).val()
},
contentType: 'json'
});
}
})
在我的控制器中
def update_express_shipping
byebug
a = '123'
end
现在,当我单击单选按钮并选中它时,我没有在控制器中接收数据,它只给出这个 参数 {"controller"=>"spree/checkout", "action"=>"update_express_shipping"}
请让我知道我错在哪里。提前致谢。
【问题讨论】:
-
你能把日志放上去吗
标签: jquery ruby-on-rails ajax ruby-on-rails-4