function searchParse(){
var resultObj = {};
var search = window.location.search;
if(search && search.length > 1){
var search = search.substring(1);
var items = search.split(' &');
for(var index = 0; index < items.length; index ){
if(! items[index]){
continue;
}
var kv = items[index].split('=');
resultObj[kv[0]] = typeof kv[1] === "undefined" ? "":kv[1];
}
}
return resultObj;
}
//Sample Code
//Url:http://localhost/default.aspx?a=hello&b=kt&c=group
var searchObj = searchParse ();
var a = searchObj["a"]; //a==hello
var b = searchObj["b"]; //b== kt
var c = searchObj[" c"]; //c== group
If the above code is not good enough, you can refer to the following article.
Javascript gets the url parameter and gets the url parameter function code in the script tag JavaScript URL parameter reading improved version
javascript[js] code to get url parameters