In this article,you will learn How can I get query string values in JavaScript/jQuery?
var id= '@Request.QueryString["ID"]';
<script>
$(document).ready(function () {
var id = GetParameterValues('ID');
var name = GetParameterValues('Name');
alert("Hello " + id+ " your ID is " + name);
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] == param) {
return urlparam[1];
}
}
}
});
</script>
How can I get query string values in JavaScript/jQuery?, Get Values From Query String Using jQuery
minify code