我有一个简单的表格:
= form_for(posts_path, :id => "new_post", :remote => true) do
= text_field_tag "post[input]"
= submit_tag "Post!"
我已将回调绑定到ajax:success
事件:
$("form#new_post").bind("ajax:success", function(xhr, data, status){
alert("Post Created!");
});
当我单击Post!
按钮时,Post Created
会出现两次。为什么?
我正在使用默认情况下使用 jquery-ujs 的 Rails 3.1。