开发者

Rails3, JQuery and RJS (UJS)

I am trying to get ajax callba开发者_开发问答cks 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


Try to "live"

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

or this:

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

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜