截取location.search,轉換爲一個對象:
function formatSearch(se){
if (typeof se !== "undefined") {
se = se.substr(1);
var arr = se.split("&"),
obj = {},
newarr = [];
$.each(arr, function(i, v){
newarr = v.split("=");
if(typeof obj[newarr[0]] === "undefined"){
obj[newarr[0]] = newarr[1];
}
});
return obj;
};
}