Skip to content

Instantly share code, notes, and snippets.

@Redolance
Created June 13, 2018 02:16
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 Redolance/19565131fdaa17ed12bb0ab81465a828 to your computer and use it in GitHub Desktop.
Save Redolance/19565131fdaa17ed12bb0ab81465a828 to your computer and use it in GitHub Desktop.
get param from url with jquery
// the function
$.urlParam = function(name){
var results = new RegExp('[\?&]' + name + '=([^]*)').exec(window.location.href);
if (results==null){
return null;
}
else{
return results[1] || 0;
}
}
// usage
var deal_id = $.urlParam('your_param');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment