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 207405
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T17:43:58+00:00 2026-05-11T17:43:58+00:00

If I am on a page such as http://somesite.com/somepage.php?param1=asdf In the JavaScript of that

  • 0

If I am on a page such as

http://somesite.com/somepage.php?param1=asdf

In the JavaScript of that page, I would like to set a variable to the value of the parameter in the GET part of the URL.

So in JavaScript:

<script>
   param1var = ...   // ... would be replaced with the code to get asdf from URI
</script>

What would “…” be?

  • 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-11T17:43:58+00:00Added an answer on May 11, 2026 at 5:43 pm

    Here’s some sample code for that.

    <script>
    var param1var = getQueryVariable("param1");
    
    function getQueryVariable(variable) {
      var query = window.location.search.substring(1);
      var vars = query.split("&");
      for (var i=0;i<vars.length;i++) {
        var pair = vars[i].split("=");
        if (pair[0] == variable) {
          return pair[1];
        }
      } 
      alert('Query Variable ' + variable + ' not found');
    }
    </script>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have paginated URLs that look like http://www.domain.com/tag/apple/page/1/ If a URL such as http://www.domain.com/tag/apple/page/*2/
I have noticed in some site such as http://mashable.com that when you open page
I've got a number of users, each with the website page like http://www.mysite.com/folder/artist_id.php?id=33 The
How would I rewrite a URL such as: http://www.site.com/sub-directory/page-name to http://www.site.com/page-name ?
I have a Ajax heavy application that may have a URL such as http://example.com/myApp/#page=1
I'm trying to embed a mapquest direction page such as http://www.mapquest.com/maps?1c=Ann+Arbor&1s=MI&1a=1440+Hubbard+St&1z=48109-2083&1y=US&1l=42.293437&1g=-83.724491&1v=ADDRESS&2c=Ann+Arbor&2s=MI&2a=930+N+University+Ave&2z=48109-1055&2y=US&2l=42.278558&2g=-83.737969&2v=ADDRESS using an iframe.
Im trying to find how to take a page request such as http://www.domain.com/sam/?dog=woof&cat=meow and
When looking at a Google search results page, such as http://www.google.com/search?q=test , is there
It possible to rewrite url of the form http://website.com/page.php to http://page.website.com , and when
I'd like to 'fake' a 404 page in Rails. In PHP, I would just

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.