I have a url:
www.domain.com/bla/
and button in result page:
show 10, 20, 50 per page
and pagination:
1, 2, 3, 5..
but once I have clicked 10
, url becomes www.domain.com/bla/?show=10
, and then if i click page 2
, show=10
is disappearing and becoming www.domain.com/bla/?page=2
I have several solution in js, but what is the best and professional way of doing this?
my code:
var show= $('#show').val();
var url = String(window.location);
if(url.indexOf("page") !== -1){
var newurl = url +'&show='+show;
$('.entries').html(' ').load(newurl, function(){
$(this).fadeIn();
});
}else{
var newurl = url +'?show='+sortterm;
$('.entries').html(' ').load(newurl, function(){
$(this).fadeIn();
});
}