Remove %20 URL code

Asked

Viewed 532 times

0

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

link: page.php? value=%20meuvalor

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



        });
  • 3

    In fact, the character %20 is a blank space, so probably valorGrup has a white space at the beginning.

  • 1

    Try using . Trim(): var valorGrup= $(this).text().trim();

  • @Andersoncarloswoss you were right. I used an expression to remove the whitespace. And it worked. The strange thing is that it was generating a +.But it has been solved.Thank you.

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.