For some reason, when I click the button, my controller and the resulting jquery function are called twice. Since the js function being called is switched, this is a problem, as it causes the code to be scanned and turned off.
Here is the form:
Unseen Notifications: <%= current_user.notification_unseen %> </div> <%= button_to "show", {:action => "seen", :controller=>"notifications"}, :remote => true %>
Here is the controller:
def seen respond_to do |format| format.js end end
Here is jQuery:
$("div#notifications").toggle(); $("div#count").html("<%= escape_javascript( render :partial => 'notifications/count')%>");
I am at a loss why this might happen. I tried very hard not to double-click and do not know how to prevent it. Any suggestions would be very helpful.
javascript jquery ruby ajax ruby-on-rails
Spencer
source share