Jquery – Getting QueryString Parameters’ Value

Getting Values from Querystring parameter is quite easy using Jquery

e.g if the below mentioned is url with querystring
http://localhost/CreateQryString.aspx?Node1=9000%20&Node2=3000

var url = window.location.href;
var Node1= null;
var Node2= null;

if (url.indexOf(‘?Node1=’) != -1)
{

Node1= $.query.get(‘Node1’);
 Node2= $.query.get(‘Node2’);

}

In the above code window.location.href  is Javascript property of DOM window object allows us to get or set the current URL. We can access the href property through location.href or window.location.href

For $.query.get()  function  You need to add following Jquery script references

<script type=”text/javascript” src=”jquery.query-2.1.7.js”></script>

<script type=”text/javascript” src=”jquery.rc4.js”></script>

Advertisements