Created
January 27, 2012 12:21
-
-
Save iMagesh/1688533 to your computer and use it in GitHub Desktop.
Ajaxify will_paginate
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function fetchParams(link){ | |
| var vars = [], hash; | |
| var hashes = link.slice(link.indexOf('?') + 1).split('&'); | |
| for(var i = 0; i < hashes.length; i++) | |
| { | |
| hash = hashes[i].split('='); | |
| vars.push(hash[0]); | |
| vars[hash[0]] = hash[1]; | |
| } | |
| return vars; | |
| } | |
| $(function () { | |
| $('.todo-pagination a').live('click', function (event) { | |
| event.preventDefault(); | |
| var params = fetchParams(this.href); | |
| $.ajax({url: "/casein/schedules/more_todos",type: 'get', data: {page: params["page"]}}); | |
| }); | |
| }) | |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
These are the jquery function that i used along with will_paginate plugin to ajaxify it