Skip to content
a plugin that extends jquery to easily access querystring params.
JavaScript HTML
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.


@author gehsekky

code taken from here

it should be noted that the $.querystring function ALWAYS returns a string. the following should illustrate:

  • querystring param exists and has value: that value
  • querystring param exists and doesn't have value: empty string
  • querystring param does not exist: empty string
  • param given is empty string: empty string

also, as stated in the above stackoverflow answer, this solution doesn't handle multi-value keys (eg. ?key1=aa&key2=bb&key1=bb) as it just grabs the last one.


var qvalue = $.querystring("q");

$.querystringToJSON should always return an object with keys and values. This function DOES handle multi-value keys by packing them into an array.


var qobject = $.querystringToJSON();
alert(qobject.key1[1]) // result: bb
You can’t perform that action at this time.