Skip to content

Instantly share code, notes, and snippets.

@wangwen1220
Last active December 6, 2016 10:10
Show Gist options
  • Select an option

  • Save wangwen1220/8310685 to your computer and use it in GitHub Desktop.

Select an option

Save wangwen1220/8310685 to your computer and use it in GitHub Desktop.
JS: jQuery 获取 URL 中传递的参数 | urlparam
// 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