I have a URL like http://blog.com/post/1 and I need a function which updates the number at the end of it, for pagination.
So far I have:
window.location(document.URL++);
var url = window.location.href.split('/'),
page = parseInt(url.pop(), 10);
// to go to next page, increment page number and join with URL
window.location.href = url.join('/') +'/'+ (++page);
FIDDLE
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With