dizballanze

get_query_params

Nov 27th, 2012
160
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function get_query_params() {
  2.     var keyvalues = window.location.search.split('&');
  3.     if (keyvalues.length) {
  4.         keyvalues[0] = keyvalues[0].substr(1);
  5.     }
  6.     ret = {};
  7.     for (key in keyvalues) {
  8.         if (!keyvalues[key].length)
  9.             continue;
  10.         parts = keyvalues[key].split('=');
  11.         ret[parts[0]] = parts[1];
  12.     }
  13.     return ret;
  14. }
Advertisement
Add Comment
Please, Sign In to add comment