Saturday, December 20, 2014

How to get querystring in jquery or Javascript?

<div dir="ltr" style="text-align: left;" trbidi="on">
<script type="text/javascript" src="http://code.jquery.com/jquery-1.8.2.js"></script>
<script type="text/javascript">
$(function () {
var modetype = GetParameterValues('new');
alert(modetype);

});
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>

<div>

</div>
<br /></div>

No comments:

Post a Comment