Parse querystring arguments - Node.js Network

Node.js examples for Network:URL

Description

Parse querystring arguments

Demo Code

function HTTParguments() {
  var args = new Array();
  var arglist = location.search.Trim();
  if (arglist.charAt(0) == '?') arglist = arglist.substr(1);
  var argsep = arglist.split('&');
  var thisValue;/*from ww  w. j  a  va2 s . c  om*/
  for (var i = 0; i < argsep.length; i++) {
    thisValue = argsep[i].split("=");
    if (thisValue.length == 2) args[unescape(thisValue[0])] = unescape(thisValue[1]);
  }
  return args;
}

Related Tutorials