Created
June 13, 2018 02:16
-
-
Save Redolance/19565131fdaa17ed12bb0ab81465a828 to your computer and use it in GitHub Desktop.
get param from url with jquery
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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