Node.js examples for Data Structure:Map
Returns url variables in a hashtable
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++) {/*from ww w.j av a 2 s . c o m*/ hash = hashes[i].split('='); vars.push(hash[0]); vars[hash[0]] = hash[1]; } return vars; } // Returns url variables in a hashtable function parseGetVars(param) { var vars = [], hash; var hashes = param.split('&'); for(var i = 0; i < hashes.length; i++) { hash = hashes[i].split('='); vars.push(hash[0]); vars[hash[0]] = hash[1]; } return vars; }