I'm using Rails 3 with default javascript library (prototype, I believe) and I want to render a link that makes an AJAX call when pressed.
Here's my sample HAML code:
= link_to "test link", {controller: :information, action: :faq}, remote: true, id: "abc"
:javascript
$("abc").bind('ajax:beforeSend', function(){
alert('begin!');
})
Right now, I'm just testing the code by hand. The idea is that I should click on the link and an alert box should pop up that says "begin!" but no alert dialog pops up when I click on the hyperlink.
I've also tried to switch the binding from ajax:beforeSend
to ajax:before
, but this doesn't work either.
any ideas on what i'm doing wrong?
Thanks!