Skip to content

Instantly share code, notes, and snippets.

@dannyroberts
Created November 4, 2010 18:45
Show Gist options
  • Save dannyroberts/662940 to your computer and use it in GitHub Desktop.
Save dannyroberts/662940 to your computer and use it in GitHub Desktop.
/* copied from http://www.netlobo.com/url_query_string_javascript.html */
function get_url_param( name )
{
name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
var regexS = "[\\?&]"+name+"=([^&#]*)";
var regex = new RegExp( regexS );
var results = regex.exec( window.location.href );
if( results == null )
return "";
else
return results[1];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment