how to get a variable from a link using jquery and php?
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?
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/
精彩评论