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
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.