[英]Rails 4 - json.jbuilder with remotipart
My Application details 我的申请资料
gem remotipart (1.2.1)
gem remotipart (1.2.1)
paperclip (~> 4.1)
paperclip (~> 4.1)
I have a form with remote: true
and multipart: true
. 我有一个带有
remote: true
和multipart: true
的表单。 I am redering a json.jbuilder template after submitting the form. 提交表单后,我将重新编写json.jbuilder模板。 I have
ajax:success
callback on the form. 我在表单上有
ajax:success
回调。
When I submit a form without an attachment then it renders json.jbuilder template and ajax:success
callback works. 当我提交不带附件的表单时,它将呈现json.jbuilder模板,而
ajax:success
回调也可以工作。 But if I submit a form with an attachment then the form gets submitted rendering json.jbuilder file. 但是,如果我提交带有附件的表单,则该表单将提交呈现的json.jbuilder文件。 But the
ajax:success
callback doesn't work. 但是
ajax:success
回调不起作用。
I have been struggling with this issue since 2 days. 自2天以来,我一直在努力解决这个问题。
Thanks in advance 提前致谢
I was trying to use 我正在尝试使用
hidden_field "format", :json
But it didn't work. 但这没有用。 After adding option
添加选项后
:'data-type' => :json
for the form_for
it worked. for
form_for
它工作。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.