how to get query sring value in javascript

Mani5155
Posted by Mani5155 under JavaScript category on | Points: 40 | Views : 2065
we use the following code snippet to get query string value in java script

function one()
{
var quer_val=getParameterByName("query_name ");
}

function getParameterByName(name) {
name = name.replace(/[\[]/, "\\\[").replace(/[\]]/, "\\\]");
var regexS = "[\\?&]" + name + "=([^&#]*)";
var regex = new RegExp(regexS);
var results = regex.exec(window.location.search);
if (results == null)
return "";
else
return decodeURIComponent(results[1].replace(/\+/g, " "));
}

Comments or Responses

Posted by: Hariinakoti on: 4/10/2012 Level:Starter | Status: [Member] | Points: 10
Thanq for adding mani
Posted by: Mani5155 on: 4/11/2012 Level:Starter | Status: [Member] | Points: 10
fine Hariinakoti

Login to post response