mirror of
https://gitlab.easter-eggs.com/ee/ldapsaisie.git
synced 2024-12-18 22:43:47 +01:00
functions.js : add urlAddVar function
This commit is contained in:
parent
0f53dcfd34
commit
8c79b9fffd
1 changed files with 22 additions and 0 deletions
|
@ -144,3 +144,25 @@ function replaceSpaces(str,to) {
|
||||||
}
|
}
|
||||||
return new_str;
|
return new_str;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add one variable with value in URL
|
||||||
|
* @param[in] url string The original URL
|
||||||
|
* @param[in] name string The variable name
|
||||||
|
* @param[in] value string The value of the variable
|
||||||
|
*
|
||||||
|
* @retval string The URL with the value
|
||||||
|
*/
|
||||||
|
function urlAddVar(url,name,value) {
|
||||||
|
if ($type(url)) {
|
||||||
|
var isExtended = RegExp('[?]');
|
||||||
|
if (isExtended.test(url)) {
|
||||||
|
url=url+'&';
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
url=url+'?';
|
||||||
|
}
|
||||||
|
return url + name + '=' + value;
|
||||||
|
}
|
||||||
|
return url;
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue