Redirection with AJAX
Clone this wiki locally
This has some implications for the AJAX content loaded. Firstly, AJAX Pagination adds to requests a parameter to the querystring so that the server-side code knows that it is an AJAX Pagination request. This would normally be lost in the redirection process. However, this would otherwise be easily solved, and is not a big problem.
The implementation should not affect other redirect requests, because it is only active when the request is an AJAX Pagination request. Even other AJAX requests will not be affected.
There is one detail to ensure when redirecting. The new page will receive the AJAX request, along with the fact that it is an AJAX Pagination request. It needs code to handle the response. This is the same as any other response, and more detail is available at Responding to AJAX requests.
It is possible to disable the after_filter added to the ActionController. Simply generate an initializer and set config.redirect_after_filter = false. The after_filter can be added again only to specific controllers with: