Archive for August 1st, 2007

How to Paginate With Ajax

Posted in ajax, paginate, ror, Rails, Ruby on Rails on August 1st, 2007 by Satish Chauhan – Be the first to comment

Pagination is a very common task in web application development. But sometimes we need to paginate something with ajax request. The interest to use Ajax for this is to provide a dynamic interface which doesn’t need to reload the entire page when next results(page) displayed. Ajax is really nicely integrated with Rails, and using it is very easier with this great framework. To work with ajax requests your browser must be enabled to handled java script requests. I knew two methods for that problem.

First Method

Your Controller code

Layout

View

Second Method

Put this code in a helper somewhere

and use following code for creating links
View