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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T19:08:02+00:00 2026-05-31T19:08:02+00:00

http://www.domainname.com/#changepassword I need to pass an extra variable with a URL like above. I’ve

  • 0

http://www.domainname.com/#changepassword

I need to pass an extra variable with a URL like above.

I’ve tried a few ways but I’m unsure of the best way to do this eg:

http://www.domainname.com/#changepassword?variable

I’m using the following JQUERY to catch the HASH:

if (window.location.hash != '') {
    var hash = window.location.hash.substring(1);
    if(hash == 'changepassword') {      // Password Change
        alert('changepassword');
    }
}

How can I pass an extra variable with the HASH? Best method to capture the HASH and extra variable.

thx

  • 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-31T19:08:04+00:00Added an answer on May 31, 2026 at 7:08 pm

    You are mixing the location.hash with location.search – see here for the explanation

    You could use just the location.hash and put a seperator between your “variables” :

    For example .. if this was your url http://www.domainname.com/#changepassword-variable-another then you could do

    var hash = window.location.hash.substring(1);
    var hasharray = hash.split['-']
    if(hasharray[0] == 'changepassword') {      // Password Change
        alert('changepassword');
    }
    

    or you could use the location.search and the following example :

    URL : http://www.domainname.com/?command=changepassword&var=variable&var2=another

    this uses the key=value format, then use the following method to access the values

    function getQueryString() {
      var result = {}, queryString = location.search.substring(1),
          re = /([^&=]+)=([^&]*)/g, m;
    
      while (m = re.exec(queryString)) {
        result[decodeURIComponent(m[1])] = decodeURIComponent(m[2]);
      }
    
      return result;
    }
    

    You can then get the values by passing the function your key

    var command = getQueryString()["command"];
    if(command == 'changepassword') {      // Password Change
        alert('changepassword');
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I click on the next link. It shows me the URL like http://www.domainname.com/fj_messages/index/page:2 I
I have a table setup like below: <table> <tr> <td class=url> <a href=http://www.domainname.com/page1.html />
I have some page, it's url is like http://www.domainname.com/m1.php?#m2.php?more=apple&starting=1 . I want get the
I need a regular expression to match this URL to enable URL rewriting. http://www.somewhere.com/index.php?route=common/home
i have bunch of rows containing http://www.domainname.com i need to update those so http://
I have some urls like http://www.domainname.com/m1.php?#m2.php?more=apple&starting=1 How to use PHP to get the value
http://www.validome.org/xml/validate/?lang=en&viewSourceCode=1&url=http://45143.com/finance-feed/abc.xml&onlyWellFormed=1 check the url above for validator results. Line 171 in the XSD is
Imagine that I have url http://www.google.com/subdomain/blah-blah.../.. /.. So I want to extract 4 things
let's say we have this: http://www.domainname.com/somepage.php?c=innerContent How to retrieve with jQuery only the page
http://www.codeplex.com/IIRF/Thread/List.aspx My webhost installed IIRF for me and I am convinced that they did

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.