Hello there,
I have come across the situation to get QueryString in JQuery and have some logic inside that so I am sharing the same.
<!DOCTYPE
html>
<html
lang="en"
xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta
charset="utf-8"
/>
<title></title>
<script
type="text/javascript">
$(document).ready(function
() {
var
val = GetQuery('a');
if
(val == 'someval')
{
//HERE
YOU CAN WRITE THE LOGIC AS PER THE VALUE YOU GET
}
function
GetQuery(p) {
var
url = window.locaion.href.slice(window.location.href.indexof('?')
+ 1).split('&');
for
(var
i = 0 ; i < url.length; i++) {
var
urlp = url[i].split('=');
if
(urlp[0] == p) {
return
urlp[1];
}
}
}
});
</script>
</head>
<body>
</body>
</html>
No comments:
Post a Comment