Posted By

gromitski on 11/19/13


Tagged

get url javascript variable


Versions (?)

Reading GET variables in Javascript


 / Published in: JavaScript
 

URL: http://gromitski.com/blog/get-variables-in-javascript/

Function enables the reading of url appended variables. See URL for more information.

  1. function getParameterByName(name) {
  2. var match = RegExp('[?&]' + name + '=([^&]*)').exec(window.location.search);
  3. return match && decodeURIComponent(match[1].replace(/\+/g, ' '));
  4. }

Report this snippet  

You need to login to post a comment.