• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 345
  • Last Modified:

Retrieve Query String parameters

How can I retrieve query string parameters from my javascript code?

If possible, please provide some sample code.
Thanks!
0
dshrenik
Asked:
dshrenik
3 Solutions
 
leakim971PluritechnicianCommented:
0
 
Gurvinder Pal SinghCommented:
If you meant the Current URL query string parameters, then you just have to do

var queryString = location.search;

var keyPairsCombined = queryString.split("&");
var keyPairMap = new Array();

for ( var counter = 0; counter < keyPairsCombined.length; counter++)
{
   var keyPair = keyPairsCombined[ counter ].split("=");
   keyPairMap[ keyPair[ 0 ] ] = keyPair[ 1 ];
}

now just mention the name like
alert(keyPairMap.name);
0
 
Kiran SonawaneProject LeadCommented:
This link has number of ways to extract the query strings

http://stackoverflow.com/questions/901115/get-query-string-values-in-javascript
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now