js获取url后面的参数
$(function () {
//window.location.search.substring(1) 截取问号之后的字符串
//比如有如下链接"./page2.html?name=" + name + "&age=" + age
//截取之后 name=lucy&age=20
var str = window.location.search.substring(1);
var array = str.split("&");
var params = {};
for (var i =0; i < array.length; i++) {
var tmp = array[i].split("=");
params[tmp[0]] = tmp[1];
}
})