How to find Out the Parameter value from the Query String in the URL?
Here is the Code to do this-
function GetParameterValues(param) {
var url = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&');
for (var i = 0; i < url.length; i++) {
var urlparam = url[i].split('=');
if (urlparam[0].toLowerCase() == param.toLowerCase()) {
return urlparam[1];
}
}
}
Use:
<script>
var name = GetParameterValues('name');
var id = GetParameterValues('ID');
alert("Hello " + name + " your ID is " + id);
</script>
No comments:
Post a Comment