Last active
December 6, 2016 10:10
-
-
Save wangwen1220/8310685 to your computer and use it in GitHub Desktop.
JS: jQuery 获取 URL 中传递的参数 | urlparam
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
| // jQuery 获取 URL 中传递的参数 | |
| $.urlParam = function(name) { | |
| var results = new RegExp('[\\?&]' + name + '=([^&#]*)').exec(window.location.href); | |
| if (!results) { return 0; } | |
| return results[1] || 0; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment