/ Published in: Rails
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
//ajax function------------------------------------- function ajax_will_paginate(s){ $.ajax({ type: "POST", url: "index/blog_paginate?page="+s, success: function(msg){ $("div.blog[style='display: block;']").html(msg); replace_paginate_links(); } }); } // replace links function--------------------------- function replace_paginate_links(){ $('div.pagination a').each(function(){ var new_attr = "ajax_will_paginate" var get_href_a = $(this).attr('href').split('='); var get_href = get_href_a[get_href_a.length-1] $(this).attr('href',"#") $(this).attr('onclick',"ajax_will_paginate('"+get_href+"'); return false;") }) } $(document).ready(function(){ replace_paginate_links() })