2
I am creating a functionality for a system and I came across the need to manipulate URL parameters in this way I would like to know, how to delete a certain parameter from the URL?
Follow a clearer example:
http://site.com.br?c=cliente&a=editar&id=31228
I need to remove the parameter a=editar of the URL, I tried to do as follows:
var urlReplace = document.URL.replace('&a=editar','');
or
var urlReplace = document.URL.replace(/&a=editar/g,'');
However, neither of the two ways worked!!!
What gives you
document.URL? I don’t see whyvar urlReplace = document.URL.replace('&a=editar','');doesn’t work, that’s correct...– Sergio
`Document.URL returns the full URL of my site. And it doesn’t work, as I presented above.
– Ewerton Melo
And you tested
window.location = urlReplace;?– Sergio