I've searched the internet and stackoverflow for how to trigger a second click function and this is what I found:

```
$('.elementclass').toggle(
function(){
   //on odd
    },
function(){
   //on even
}); 

```

It's perfect. Now according to this I try to change the URL of my document but something doesn't work. Here is my code:

```
$('.orderby').toggle(
function(){
      document.location.href+='?orderby='+$(this).val()+'ASC';
},
function(){
      document.location.href+='?orderby='+$(this).val()+'DESC';
});

```

where `$(this).val()` will be something like name or date...

What I want to accomplish is: on first click of a button, the URL changes to <http://blablabla/page.php?orderby=nameASC> and then on the second click, the URL changes to <http://blablabla/page.php?orderby=nameDESC>.

So what's wrong with my code?

**I don't want to refresh the page when user click on button, I just want to add some (one in this case) parameters that can take whit $\_GET later but on same page.document.URL can be update whit +=?orderby=nameASC on first click and on second click +=?orderby=nameASC need to be remove and document.URL update whit +=?orderby=nameDESC.**