Parser error when using jQuery-UJS for remote link_to in Rails 3 app: how can I debug this?

后端 未结 7 1988
刺人心
刺人心 2021-02-14 12:55

I\'m trying to replace the content of a div after clicking on a link using Rails 3, remote_link :remote => true and jQuery.

So far, I\'ve been able to ge

7条回答
  •  一向
    一向 (楼主)
    2021-02-14 13:36

    Instead of using the global $.ajaxSettings.dataType = 'json'; setting a cleaner solution is to add a data-type attribute to the form element. The remote form event handlers will pass this through as the dataType to the jQuery AJAX call, e.g:

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

提交回复
热议问题