<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>KafeKafe &#187; Get URL Variables</title>
	<atom:link href="http://kafekafe.com/wordpress-mu/tag/get-url-variables/feed/" rel="self" type="application/rss+xml" />
	<link>http://kafekafe.com/wordpress-mu</link>
	<description>Just another Kafekafe.com weblog</description>
	<lastBuildDate>Tue, 09 Jul 2013 01:15:58 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.5.2</generator>
		<item>
		<title>Get URL Variables</title>
		<link>http://kafekafe.com/wordpress-mu/2010/01/25/get-url-variables/</link>
		<comments>http://kafekafe.com/wordpress-mu/2010/01/25/get-url-variables/#comments</comments>
		<pubDate>Mon, 25 Jan 2010 07:16:07 +0000</pubDate>
		<dc:creator>echen</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Tech]]></category>
		<category><![CDATA[Get URL Variables]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[Parse URL Variables]]></category>

		<guid isPermaLink="false">http://kafekafe.com/wordpress-mu/?p=1091</guid>
		<description><![CDATA[The following JavaScript code parses and stores URL variables into a hash variable: // Read a page&#8217;s GET URL variables and return them as an associative array. function getUrlVars() { var vars = [], hash; var hashes = window.location.href.slice(window.location.href.indexOf(&#8216;?&#8217;) + 1).split(&#8216;&#38;&#8217;); for(var i = 0; i &#60; hashes.length; i++) { hash = hashes[i].split(&#8216;=&#8217;); vars.push(hash[0]); vars[hash[0]] [...]]]></description>
				<content:encoded><![CDATA[<div id="snipplr_embed_799" class="snipplr_embed">The following JavaScript code parses and stores URL variables into a hash variable:</div>
<blockquote><p><i>// Read a page&#8217;s GET URL variables and return them as an associative array.<br />
function getUrlVars()<br />
{<br />
var vars = [], hash;<br />
var hashes = window.location.href.slice(window.location.href.indexOf(&#8216;?&#8217;) + 1).split(&#8216;&amp;&#8217;);</p>
<p>for(var i = 0; i &lt; hashes.length; i++)<br />
{<br />
hash = hashes[i].split(&#8216;=&#8217;);<br />
vars.push(hash[0]);<br />
vars[hash[0]] = hash[1];<br />
}</p>
<p>return vars;<br />
}</i></p></blockquote>
<p>I updated this code to instead write the URL variables into JavaScript global variables:</p>
<blockquote><p><i>// Read a page&#8217;s GET URL variables and write them as Global variables.<br />
function getUrlVars()<br />
{<br />
var hashes = window.location.href.slice(window.location.href.indexOf(&#8216;?&#8217;) + 1).split(&#8216;&amp;&#8217;);</p>
<p>for(var i = 0; i &lt; hashes.length; i++)<br />
{<br />
hash = hashes[i].split(&#8216;=&#8217;);<br />
window[hash[0]]=hash[1];<br />
}<br />
}</i></p></blockquote>
<p>via <a href="http://snipplr.com/view.php?codeview&amp;id=799">Get URL Variables &#8211; JavaScript &#8211; Snipplr</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://kafekafe.com/wordpress-mu/2010/01/25/get-url-variables/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
