javascript add query string to url
function setParam(uri, key, val) {
return uri
.replace(RegExp("([?&]"+key+"(?=[=&#]|$)[^#&]*|(?=#|$))"), "&"+key+"="+encodeURIComponent(val))
.replace(/^([^?&]+)&/, "$1?");
}function updateQueryStringParameter(uri, key, value) {
var re = new RegExp("([?&])" + key + "=.*?(&|$)", "i");
var separator = uri.indexOf('?') !== -1 ? "&" : "?";
if (uri.match(re)) {
return uri.replace(re, '$1' + key + "=" + value + '$2');
}
else {
return uri + separator + key + "=" + value;
}
}
Also in JavaScript:
- react check if array contains value
- angular 8 how to iterate json object in view
- Javascript validate password
- axios file upload
- How do you select a particular option in a SELECT element in jQuery?
- Error: There was an unhandled exception on the current circuit, so this circuit will be terminated. For more details turn on detailed exceptions by setting 'DetailedErrors: true' in 'appSettings.Development.json' or set 'CircuitOptions.DetailedErrors'.
- how to get the square root in js
- javaascript all
- rails call multiple variable format json
- javascript object total
- javascript remove characters from beginning of string
- how to append in javascript
- javascript ... operator three dots
- Target type ieee.std_logic_1164.STD_LOGIC_VECTOR in variable assignment is different from expression type ieee.std_logic_1164.STD_ULOGIC.
- js .length
- array alphabet
- react href
- Une erreur JavaScript fatale s'est produite. Faut-il envoyer un rapport d'erreurs
- encode url javascript
- add option to select jquery
- how to check if user has installed pwa
- what is lexical environment in javascript
- javascript random six digit number with animation
- javascript on click radio button get value