Posted By

insanedreamer on 08/04/10


Tagged

ajax javascript rails


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

jwilcox09


ajax pagination links


 / Published in: Rails
 

tag links with .click function

  1. ## view:
  2.  
  3. .pagination
  4. =will_paginate @photos, :class => 'digg_pagination'
  5.  
  6.  
  7. ## application.js
  8.  
  9. document.observe("dom:loaded", function() {
  10. ajax_pagination()
  11. })
  12.  
  13. // ajax pagination links
  14. var ajax_pagination = function () {
  15. var container = $(document.body)
  16. container.observe('click', function(e) {
  17. var el = e.element()
  18. if (el.match('.digg_pagination a')) {
  19. new Ajax.Request(el.href, { method: 'get' })
  20. e.stop()
  21. }
  22. })
  23. }

Report this snippet  

You need to login to post a comment.