Solved

Retrieve Query String parameters

Posted on 2011-09-05
3
329 Views
Last Modified: 2012-06-22
How can I retrieve query string parameters from my javascript code?

If possible, please provide some sample code.
Thanks!
0
Comment
Question by:dshrenik
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 82

Assisted Solution

by:leakim971
leakim971 earned 125 total points
ID: 36486368
0
 
LVL 40

Accepted Solution

by:
gurvinder372 earned 250 total points
ID: 36486415
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
 
LVL 17

Assisted Solution

by:sonawanekiran
sonawanekiran earned 125 total points
ID: 36486504
This link has number of ways to extract the query strings

http://stackoverflow.com/questions/901115/get-query-string-values-in-javascript
0

Featured Post

Business Impact of IT Communications

What are the business impacts of how well businesses communicate during an IT incident? Targeting, speed, and transparency all matter. Find out more in this infographic.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

FAQ pages provide a simple way for you to supply and for customers to find answers to the most common questions about your company. Here are six reasons why your company website should have a FAQ page
Color can increase conversions, create feelings of warmth or even incite people to get behind a cause. If you want your website to really impact site visitors, then it is vital to consider the impact color has on them.
HTML5 has deprecated a few of the older ways of showing media as well as offering up a new way to create games and animations. Audio, video, and canvas are just a few of the adjustments made between XHTML and HTML5. As we learned in our last micr…
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

707 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question