I have done complete bins for above solution.
Follow Steps as below:
1) Include latest jquery.js file.
2) Include querystring-0.9.0.js for getting query string variable value in js.
3) HTML :
<a href="#?param1=abc¶m2=def">
abc
</a>
Here i have used "#?param1=abc¶m2=def" because on bins it is not possible redirect page and execute our java script, so that i have just added query string on same page and test it.
4) jQuery in script tag:
$(function() {
$("a").click(function() {
setTimeout(function() {
var param1 = $.QueryString("param1");
var param2 = $.QueryString("param2");
alert(param1);
alert(param2);
}, 300);
});
});
Above script is working fine, if query strings has been added on the same page, but for the different page navigation, you have to remove setTimeout function but keep script as it is inside in it and execute these statements as below on the page where you navigates with query string. so, the different navigation has needs to be included jquery and querystring-0.9.0.js both java script files in header first.
$(function() {
var param1 = $.QueryString("param1");
var param2 = $.QueryString("param2");
alert(param1);
alert(param2);
});
You can try on http://codebins.com/bin/4ldqpac