var queryString = url.substring( url.indexOf('?') + 1 );
or
function queryString(keyName) {
var query = window.location.search.substring(1);
var vars = query.split('&');
for (var i = 0; i < vars.length; i++) {
var pair = vars[i].split('=');
if (decodeURIComponent(pair[0]) == keyName) { return decodeURIComponent(pair[1]);
}
}
return null;
}
In JQuery:Get Query String Vals:
e.g if the below mentioned is url with querystring
var url = window.location.href; // or location.href
var Node1= null;
var Node2= null;
var Node1= null;
var Node2= null;
if (url.indexOf(‘?Node1=’) != -1)
{
{
Node1= $.query.get(‘Node1’);
Node2= $.query.get(‘Node2′);
Node2= $.query.get(‘Node2′);
}
Script References for For $.query.get() function :
<script type=”text/javascript” src=”jquery.query-2.1.7.js”></script>
<script type=”text/javascript” src=”jquery.rc4.js”></script
No comments:
Post a Comment