Skip to content

Instantly share code, notes, and snippets.

@binarymax
Created September 28, 2020 15:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save binarymax/fd285281a5741b729489c81538bc3ee3 to your computer and use it in GitHub Desktop.
Save binarymax/fd285281a5741b729489c81538bc3ee3 to your computer and use it in GitHub Desktop.
//----------------------------------------------------------
//Gets the querystring value for the specified key
$.querystring = (function(key,url){
url = url || window.location.search;
key = key.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
var regex = new RegExp("[\\?&]"+key+"=([^&#]*)");
var results = regex.exec( url );
return (!results)?"":decodeURIComponent(results[1].replace(/\+/g, " "));
}).bind($);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment