0

i have this script on jsfiddle

basically this links:

 | <a id="mine_click" href="#?test=123">test</a> | 
 | <a id="mine_click" href="#?test=123">test1</a> | 
 | <a id="mine_click" href="#?test=123">test2</a> | 
 | <a id="mine_click" href="#?test=123">test3</a> | 

when i click on one of them i manage to change tabs but i want that test var to fallow and be displayed in the respective tab

any ideas?

1
  • 1
    Use window.location.hash to get the hash-part of your URL Commented Sep 1, 2011 at 10:05

1 Answer 1

1

You could use this function

function getUrlVars() {
    var vars = {};
    var parts = window.location.href.replace(/[?&]+([^=&]+)=([^&]*)/gi, function(m,key,value) {
        vars[key] = value;
    });
    return vars;
}

to get the variable and then print it.

fiddle here: http://jsfiddle.net/HysJ6/10/

Sign up to request clarification or add additional context in comments.

1 Comment

i test it, but it shows different values on different links. It doesn't keep the same vars, looks like you have to click 2 times on the link before the right result pops up

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.