slotishtype
slotishtype

Reputation: 2761

Rails3, JQuery and RJS (UJS)

I am trying to get ajax callbacks working on a href using remote. I have the rails.js and JQuery1.6 installed.

Here is the attempt to catch the callback:

$('#choo').bind('ajax:success', function(){
    alert("Success!");

});

Here is my div and AJAX link

<%= link_to "Choose", {:action => "choose", :id => 538}, :remote => true, :id => "choo" %>

When I click the link the ajax fires hits the server and returns the response but the callback is not working...

I have followed everything in this guide but with little by the way of success. In other words "!ajax:success" :-).

Any ideas what I am doing wrong?

EDIT++++++++++++++++++++==

I updated to 3.1 and it worked.

Cheers,

s

Upvotes: 0

Views: 336

Answers (1)

Nicklasos
Nicklasos

Reputation: 565

Try to "live"

$('#choo').live('ajax:success', function(){
  alert("Success!");
});

or this:

$('a[data-remote],input[data-remote]').live('ajax:success', function() {
  alert('success');
});

Upvotes: 1

Related Questions