开发者

Ajaxify will_paginate in rails 3.1

I am trying to ajaxify will_paginate result in rails 3.1. I have gone through the example of railscasts episode #174 but it is not working for rails 3.1.

Is there a simple way to ajaxify will_paginate result in rails3.1?

Here is index.js.erb code for loading the user partial (this file is in app/views/users folder) $('#test').html("<%= escape_javascript(render(@users)) %>");

Here is my pagination.js code (this file is in app/assets/javascripts)

  $(function() {
  $(".users a").live("click", function() {
    $.get(this.href, null, null, "script");
    return false;
  });
  });

I am using will_paginate both the files are getting 开发者_开发知识库loaded and I have tested for it.

Any help on where I am making the mistake?

Thanks,


replace the line in pagination.js:

$(".users a").live("click", function() {

with

$(".pagination a").live("click", function() {

Then just make sure your index.js.erb is named correctly. For example, if you're using pagination inside the view show.html.erb, your script has to be named show.js.erb

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜