Reading GET variables in Javascript

/ Published in: JavaScript
Save to your folder(s)

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

Copy this code and paste it in your HTML
  1. function getParameterByName(name) {
  2. var match = RegExp('[?&]' + name + '=([^&]*)').exec(;
  3. return match && decodeURIComponent(match[1].replace(/\+/g, ' '));
  4. }


Report this snippet


RSS Icon Subscribe to comments

You need to login to post a comment.