With this code you can fetch all parameters from the URL. The function will return a map with all key & value pairs.
function get_url_parameters(){ query = window.location.search.substring(1) vars = query.split("&"); hash = new Array() for (var i=0;i<vars.length;i++) { var pair = vars[i].split("="); hash[pair[0]] = pair[1] } return hash }
One thought on “Fetching URL Parameter with JavaScript”