Skip to content

Instantly share code, notes, and snippets.

@hello-qu
Created April 24, 2017 03:58
Show Gist options
  • Save hello-qu/fb4f09c854ea09791d791c7ad9db4822 to your computer and use it in GitHub Desktop.
Save hello-qu/fb4f09c854ea09791d791c7ad9db4822 to your computer and use it in GitHub Desktop.
获取url中字符串的参数
var getQueryString = function (str) {
var reg = new RegExp("(^|&)" + name + "([^&]*)(&|$)", "i");
var res = window.location.search.substr(1).match(reg);
if (!res) {
return decodeURIComponent(res[2]);
} else {
return decodeURIComponent(str);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment