8000 add get query string function · AKAChing/fed-code-snippets@109ff11 · GitHub
[go: up one dir, main page]

Skip to content

Commit 109ff11

Browse files
authored
add get query string function
1 parent b74abb9 commit 109ff11

File tree

1 file6

-0
lines changed

1 file changed

+6
-0
lines changed

getQueryParams/index.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
export function getQueryString(name) {
2+
let reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");
3+
  let r = window.location.search.substr(1).match(reg);
4+
  if (r != null) return unescape(r[2]);
5+
  return ''
6+
}

0 commit comments

Comments
 (0)
0