Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 651903
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T22:12:46+00:00 2026-05-13T22:12:46+00:00

I am retrieving one query string parameter, and for that my code is <a

  • 0

I am retrieving one query string parameter, and for that my code is

 <a href="Default2.aspx?Id=1&status=pending&year=2010">Click me</a>

Now I want to retrieve “status=pending” and for that I am doing

 var qString = window.location.search.substring(1);
                  var Keys = qString .split('&');
                 alert(Keys[1]);

This works fine, but I am hard-coding [1] here. is there any elegent way of doing this without hard-coding?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T22:12:47+00:00Added an answer on May 13, 2026 at 10:12 pm

    I’d use a regular expression such as:

    status=([a-zA-Z])+
    

    This will retrieve only what the status is. If you already know the variable is always called status, but don’t know what the value is, this is the right way to go.

    To use it, you’d have to do something like this:

    var qString = window.location.search.substring(1);
    qString.match(/status=([a-zA-Z])+/);
    

    Hope it helps

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have used a join query for retrieving value from two tables one is
I'm encrypting my entire query string on one page, then decrypting it on another.
One of my friend has been asked with a question Retrieving the max top
I'm trying to autocomplete a textbox. I'm retrieving values from Access Database. Just one
I am developing one application. In that iam using the NSMutableArray for storing the
One thing that always been a pain is to log SQL (JDBC) errors when
I inserted one column in sql with null value from java.while retrieving back it
hope every one is doing well :) I have struck with retrieving the month
I am new sqlite. I have one table that having 3 columns 1. Id
I have the following rewrite rule: <rewrite url=^/Membership/(.+)/(.+)/(.+)/(.+) to=/Membership/Index.aspx?parentf=$3&amp;f=$4/> which I am expecting should

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.