Created
August 29, 2018 04:58
-
-
Save shubham7298/7e13c6ffef41399eeecdd2641f552b75 to your computer and use it in GitHub Desktop.
Retreiving Values from URL Query
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
function getQueryStringValue (key) { | |
return decodeURIComponent(window.location.search.replace(new RegExp("^(?:.*[&\\?]" + encodeURIComponent(key).replace(/[\.\+\*]/g, "\\$&") + "(?:\\=([^&]*))?)?.*$", "i"), "$1")); | |
} | |
// Would write the value of the QueryString-variable called name to the console | |
var quer = getQueryStringValue("a"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment