I'm trying to get a simple example of using js to retrieve querystring params working and it's not (even though I said simple). Here's my code:
I've tried putting alert statements in and debugging the old fashioned way but to be honest I'm used to using VS2017 for c# not js
Here's the code I'm using.
I have 2 html pages, the first just has a link:
<a href="h1.html?type=generalk">try me</a>
The second has the code:
    this is some text <br />
    <script> getparams2();</script>   
    this is some more text <br />   
    <script>
        function getUrlParam(parameter, defaultvalue) {
            var urlparameter = defaultvalue;
            if (window.location.href.indexOf(parameter) > -1) {
                urlparameter = getUrlVars()[parameter];
            }
            return urlparameter;
        }
    </script>
    <script>
        function getUrlVars() {
            var vars = {};
            var parts = window.location.href.replace(/[?&]+([^=&]+)=([^&]*)/gi, function (m, key, value) {
                alert(value);
                vars[key] = value;
            });
            return vars;
        }
    </script>
    <script>
        function getparams2()
        {
            var mytext = getUrlVars()["type"];
        }
    </script>
The result I'm trying to acheive is that the h1.html page can display the type parameter from the url.
Thanks in advance, Paul.
 
     
    