Just used this great snippet in a jquery script at a customer: http://snipplr.com/view/799/get-url-variables/
function getUrlVars(){ var vars = [], hash; var hashes = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&'); for(var i = 0; i < hashes.length; i++){ hash = hashes[i].split('='); vars.push(hash[0]); vars[hash[0]] = hash[1]; } return vars; } [/code] <strong>How do you use this?</strong> Well, just put this in your script: getUrlVars()["QuerystringVariable"];
This will get you the value that is in the querystring for that variable.
Example: www.balestra.be?name=marijn
If I write:
Alert(getUrlVars()["name"];
Then I will get a messagebox popped up that displays “marijn”
This comes in handy when you have to get a few variables out of the querystring !