Created
January 11, 2017 03:17
-
-
Save digimon1740/9b2ba5aae5a661b378a5ddd1ef28db58 to your computer and use it in GitHub Desktop.
javascript 로 url의 parameter 를 파싱하는 함수
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function getUrlQueries() { | |
| var args = {}; | |
| var query = location.search.substring(1); | |
| var pairs = query.split("&"); | |
| for (var i = 0; i < pairs.length; i++) { | |
| var pos = pairs[i].indexOf('='); | |
| if (pos == -1) continue; | |
| var name = pairs[i].substring(0, pos); | |
| var value = pairs[i].substring(pos + 1); | |
| value = decodeURIComponent(value); | |
| args[name] = value; | |
| } | |
| return args; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment