Answers for "javascript how to get current url parameters jquery and replace them"

1

js update query string

var searchParams = new URLSearchParams(window.location.search);
searchParams.set("foo", "bar");
window.location.search = searchParams.toString();
Posted by: Guest on October-28-2020
0

js add query param

function setParam(uri, key, val) {
    return uri
        .replace(RegExp("([?&]"+key+"(?=[=&#]|$)[^#&]*|(?=#|$))"), "&"+key+"="+encodeURIComponent(val))
        .replace(/^([^?&]+)&/, "$1?");
}
Posted by: Guest on November-21-2020

Code answers related to "javascript how to get current url parameters jquery and replace them"

Code answers related to "Javascript"

Browse Popular Code Answers by Language