using javascript to accomplish the ajax for will_paginate

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?