私は単純なフォームを持っています:
= 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
が2 回表示されます。なんで?
デフォルトでjquery-ujsを使用しているRails 3.1を使用しています。