Posted By

kyleturner on 01/16/11


Tagged

javascript jquery param


Versions (?)

Who likes this?

3 people have marked this snippet as a favorite

aanoojgmailcom
AtticBoy
VaiT


URL Parameter Access in JQuery


 / Published in: JavaScript
 

URL: http://jquery-howto.blogspot.com/2009/09/get-url-parameters-values-with-jquery.html

  1. // Read a page's GET URL variables and return them as an associative array.
  2. function getUrlVars()
  3. {
  4. var vars = [], hash;
  5. var hashes = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&');
  6. for(var i = 0; i < hashes.length; i++)
  7. {
  8. hash = hashes[i].split('=');
  9. vars.push(hash[0]);
  10. vars[hash[0]] = hash[1];
  11. }
  12. return vars;
  13. }

Report this snippet  

You need to login to post a comment.