railsでajaxでpost送信してコントローラで受け取る
view
<%= form_tag({:controller => :post_comment, :action => :index}, :remote => true, :class => 'form-ajax') do -%> <%= label_tag :名前 %> <%= text_field_tag :name %> <%= label_tag :内容 %> <%= text_area_tag :content %> <%= submit_tag "追加" %> <% end %>
conotoller
def index
@name = params[:name]
@content = params[:content]
end
root
post 'post_comment/index', to: 'post_comment#index'