Rails 3 remote form: How do I specify the content type? Rails 3 remote form: How do I specify the content type? ajax ajax

Rails 3 remote form: How do I specify the content type?


You can set the content-type with:

= form_for(@object, :remote => true, :html => {:'data-type' => 'json'})

As described in rails.js line 106.


For Rails 5, the proper way is to set a data attribute data: { type: :json }.

JQuery UJS docs