Remove URL% 20 code

0

I created a php page and when I pass it via GET to another, it shows the + sign when saved in a cookie. This + is the encoding of the% 20 code. Does anyone know how to remove the% 20 from the url? >

link: page.php? value =% 20my value

code snippet

        $('.grupos').click(function () {

            var valorGrup=  $(this).text();/pega o texto contido no elemento cuja classe é (.grupos)



            $('.grupos').attr('href','pagina.php? 
         nomeGrupo='+valorGrup);//adiciona um link na classa .grupos



        });
    
asked by anonymous 24.05.2018 / 00:39

1 answer

-1

If that's all, use replace () :

var string = "pagina.php?valor=%20meuvalor%20",
    novaString = string.replace(/%20/g, ''); 

console.log(novaString); // Output: pagina.php?valor=meuvalor
    
24.05.2018 / 00:47