当有人点击“显示表单”按钮时,我有一个通过ajax呈现的表单。表单呈现正确,但不提交。当我按提交时,没有任何反应,服务器没有收到任何东西。这是表格:
<%= form_for @employer_profile, :html => { :class => "clearfix", :id => "the_form"},
remote: true do |f| %>
<%= f.text_field :position, class: "field" %>
<%= f.submit "SAVE", class: "button button-save button-submit" %>
以下是生成的html:
<form id="the_form" class="clearfix" method="post" data-remote="true"
action="/employer_profiles/13" accept-charset="UTF-8"
<input id="employer_profile_position" class="field" type="text"
name="employer_profile[position]"></input>
<input class="button button-save button-submit" type="submit" value="SAVE"
name="commit"></input>
为什么表单没有提交?
答案 0 :(得分:0)
您是否尝试通过在呼叫中添加remote: true
参数来更改提交按钮以发送AJAX请求?
<%= f.submit "SAVE", class: "button button-save button-submit", remote: true %>