To use the ajax replacing some html element's content for my
pagination,I user some js codes like following ,but pagination still
work like a normal call,not ajax.
How do i manage?
>
> document.observe("dom:loaded", function() {
>    // pagination is the class will_paginate wraps around the links
>    $$('.pagination').each(function(pagination) {
>      // let's put the observer on the div element and not all the
> links, your browser will thank you
>      pagination.observe('click', function(e) {
>        var clicked = $(e.target);
>        // time to see if the clicked item was indeed one of the links
>        if(clicked.match('a')) {
>          // if it was, stop the default page refresh and fire an ajax
> request instead
>          // let's not forget a RESTful design wants use to use GET
> instead of the default POST method
>          e.stop();
>          /new Ajax.Updater('element_id',clicked.href,{method:'get'});
>        }
>      })
>    });
>
> }
>




--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to