2010-05-16

Introducing document.queryString for JavaScript

I got sick of not having a quick/easy reference object in JavaScript for getting a query string parameter's value.  JavaScript has always offered the window.location.search property to get the entire query string, but who wants to parse that every time?

So I set out to see how long it would take me to make a quick parser that would load it into a nice object that I could jam on the document.

Roughly 30 minutes later, I had one.  It also handles param names that contain periods (person.firstname) which is nice for those that do that with their ASP.NET MVC projects.

I don't have any docs yet, but see the quick write up at my JavaScript Jedi website if you'd like to see it in action and perhaps try it for yourself.

Enjoy!