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

3 thoughts on “Jquery – Getting QueryString Parameters’ Value”

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s