Got a solution by replacing the code with the following:
$.urlParam = function(name){
var results = new RegExp('[?&]' + name + '=([^&#]*)').exec(window.location.href);
if (results == null){
return null;
}
else {
return decodeURI(results[1]) || 0;
}
}
So for example "example.com?param1=name¶m2=&id=6"
$.urlParam('param1'); // name
$.urlParam('id'); // 6
$.urlParam('param2'); // null
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…