I searched the internet and stackoverflow to run the second click function, and here is what I found:
$('.elementclass').toggle(
function(){
},
function(){
});
It's fine. Now, according to this, I am trying to change the URL of my document, but something is not working. Here is my code:
$('.orderby').toggle(
function(){
document.location.href+='?orderby='+$(this).val()+'ASC';
},
function(){
document.location.href+='?orderby='+$(this).val()+'DESC';
});
where there $(this).val()will be something like a name or a date ...
I want to do the following: the first time the button is clicked, the URL changes to http: //blablabla/page.php? Orderby = nameASC , and then the second click, the URL changes to http: //blablabla/page.php? Orderby = nameDESC .
So what happened to my code?
, , ( ) , whit $_GET , . document.URL whit + =? orderby = nameASC + =? orderby = nameASC document.URL update whit + =? orderby = nameDESC.