Overblog Follow this blog
Edit post Administration Create my blog
Balavardhan Reddy Narani

How to Get The Query String Value in Java script and Split the String in Javascript

March 9 2009 , Written by Balavardhan Published on #ASP.Net

Get The Query String Value in Java script

Here by I am providing to Get the Query string value of a URL in Javascript and Split the String by deliminator in Javascript

var query = window.location.search.substring(1) // get the Query String into a Variable
var qsParm = new Array();
var parms = query.split('&');

for (var i=0; i<parms.length; i++)
{
var pos = parms.indexOf('=');

if (pos > 0)
{
var key = parms
.substring(0,pos); // get the Query String Key
var val = parms.substring(pos+1); // Get the Query String Key Value.
}
}

Share this post

Repost 0

Comment on this post