Posted By

cochambre on 08/01/06


Tagged

get url querystring variable


Versions (?)

Who likes this?

7 people have marked this snippet as a favorite

runebrand
meth
nicolaspar
nutella
powerkan
vali29
seanpowell


Get Querystring Variable


 / Published in: JavaScript
 

  1. function getQueryVariable(variable) {
  2. var query = window.location.search.substring(1);
  3. var vars = query.split("&");
  4. for (var i=0;i<vars.length;i++) {
  5. var pair = vars[i].split("=");
  6. if (pair[0] == variable) {
  7. return pair[1];
  8. }
  9. }
  10. }

Report this snippet  

You need to login to post a comment.