Revision: 52885
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at November 4, 2011 02:38 by sicbot
Initial Code
// This function looks for all vars sent through the address bar function getUrlVars() { var vars = [], hash; var hashes = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&'); for(var i = 0; i < hashes.length; i++) { hash = hashes[i].split('='); vars.push(hash[0]); vars[hash[0]] = hash[1]; } return vars; } // This looks to see if 'sent' was a sent through the address bar and saves the value of 'sent' to a new varable called 'NewVar' var NewVar = getUrlVars()["sent"];
Initial URL
Initial Description
(I did not write this, but I forgot where I got it.) This code will find all the variables passed though the URL and return the one you are looking for.
Initial Title
Use variables passed in the URL in Javascript/jQuery
Initial Tags
url
Initial Language
JavaScript