Link_to with :remote=>true works when bound to "click" but not "ajax:beforeSend"

Hi. I am trying to do an ajax link in Rails 3.2.1 and jQuery. I am
loading jquery.js and jquery_ujs.js. In my document ready, if I bind
to the event “click,” clicking the link fires an event, but if I click
to ajax:beforeSend, it doesn’t. Nothing happens when you click the
link in JQuery. The event does go to the controller, though.

Works:

$(document).ready(function(){
$(’.approve-item’).bind(“click”, function(evt, xhr, settings){
alert(‘click’);
})
});

Doesn’t Work:

$(document).ready(function(){
$(’.approve-item’).bind(“ajax:beforeSend”, function(evt, xhr,
settings){
alert(‘before send’);
})
});

Any ideas on how to trouble shoot this? I’ve spent hours on this and
can’t find a good reason why this isn’t working.

No errors in the Chrome console, for what it’s worth.

Thanks for any help,
Kevin

$(‘approve-item’).bind(‘ajax:before’, function( etc…

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs