Add parameter in url with javascript

0

My problem:

I have a property listing to be sorted every time a filter is done, the way I am doing when the sort option is selected, the whole content is sorted, not the current one. How do I keep the url that is in the address bar without losing the current parameters and add the parameter (& order = xxx)?

JSCODEFORORDERING

$("select.ordenacao").change(function() {
        $("select.ordenacao").each(function() {
          str = $( this ).val();
          //alert(str);
            //$("#ordenar").submit();
             location.href='lista?ctgr='+getValueQS("ctgr")+'&city='+getValueQS("city")+'&s='+getValueQS("s")+'&d='+getValueQS("d")+'&v=0'+'&vmin='+getValueQS("vmin")+'&vmax='+getValueQS("vmax")+'&submit='+getValueQS("submit")+'&ordenacao='+str;
        });
    });
function getValueQS(key) {  
      return unescape(window.location.search.replace(new RegExp("^(?:.*[&\?]" + escape(key).replace(/[\.\+\*]/g, "\$&") + "(?:\=([^&]*))?)?.*$", "i"), "$1"));  
    } 

I do not know if I'm doing it correctly, because some parameters of the above function is passed the value, others are blank by breaking the query from my sql.

    
asked by anonymous 05.11.2015 / 14:12

0 answers