JavaScript: Parse URL Variables

Published on Author craigzearfossLeave a comment
/*
Parse URL variables

This code parses the url parameters into the variable QueryString.  They can then be accessed by name. For example the variable c would be accessed as QueryString.c.
*/

var QueryString = function () {
       // This function is anonymous, is executed immediately and
       // the return value is assigned to QueryString!
       var query_string = {};
       var query = window.location.search.substring(1);
       var vars = query.split("&");
           for (var i=0;i

Leave a Reply

Your email address will not be published. Required fields are marked *