/ Published in: Rails
tag links with .click function
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
## view: .pagination =will_paginate @photos, :class => 'digg_pagination' ## application.js document.observe("dom:loaded", function() { ajax_pagination() }) // ajax pagination links var ajax_pagination = function () { var container = $(document.body) container.observe('click', function(e) { var el = e.element() if (el.match('.digg_pagination a')) { new Ajax.Request(el.href, { method: 'get' }) e.stop() } }) }