var split = location.search.replace('?', '').split('=')
split[0]
is your var name, and split[1]
is your var value. You actually don't really need jQuery for that piece of code ;)
As for twiz's comment, splitting multiple variables can be done like that:
var split = location.search.replace('?', '').split('&').map(function(val){
return val.split('=');
});
You can access variable name by split[index][0]
and value by split[index][1]
.
Of course you can use the second snippet instead of the first one for one variable too.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…