Skip to content

Instantly share code, notes, and snippets.

@ilake
Created October 2, 2013 03:35
Show Gist options
  • Save ilake/6788830 to your computer and use it in GitHub Desktop.
Save ilake/6788830 to your computer and use it in GitHub Desktop.

ujs 會利用到data-type 這個keyword data attributes, 所以當你overwriate 掉時, 你會發現送出的request, header 什麼都不吃accept /, 所以無論你return 什麼他都會看不懂, 當然你預期中的的event (ajax:success) 也不會發生, 會跑到ajax:error 去

<%= form_for @task, :remote => true, :data => {:type => 'casue_problem'} %>
  $from
    on('ajax:success'), (e, data) ->
      # do something here
    on('ajax:error'), ->
      # parseerror
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment