我在 Ruby on Rails 上有这段代码:
simple_form_for :projectssss, :html => {:id => 'projectsssss_opt'} do |f|
f.input :name, :label => ("name")
f.input :title, :label => ('title')
f.submit "Submit", :id => 'btn'
而这个Javascript:
$.ajax({
type: "POST",
url: api_url,
data: [ what to put here ???],
success: function ( status ) {
alert("HAHA"); }});
如何在 Ruby on Rails 上的 JS 中从简单表单中获取数据?