javascript - Rails: JS Controller Being Called Twice for Some Reason -



javascript - Rails: JS Controller Being Called Twice for Some Reason -

for reason when click on button, controller , resulting jquery function gets called twice. since js function beingness called toggle, problem causes code jump in , out of view.

here form:

unseen notifications: <%= current_user.notification_unseen %> </div> <%= button_to "show", {:action => "seen", :controller=>"notifications"}, :remote => true %>

here controller:

def seen respond_to |format| format.js end end

here jquery:

$("div#notifications").toggle(); $("div#count").html("<%= escape_javascript( render :partial => 'notifications/count')%>");

i @ loss why on earth perchance happen. have been careful not double click , don't know how prevent it. suggestions appreicated.

i had recent problem before, when had 2 jquery libraries included. in particular, check have jquery_ujs.js , not jquery.js. seems when include both of them js functions called twice.

hope helps!

javascript jquery ruby-on-rails ruby ajax

Comments

Popular posts from this blog

iphone - Dismissing a UIAlertView -

intellij idea - Update external libraries with intelij and java -

javascript - send data from a new window to previous window in php -