title: Get the query string value and display it in my html page
body: <p>After redirecting to home.html page, i can see the querystring values which i had given in the previous page. </p>
  
  <pre><code>Home.html?FirstName=dd&amp;LastName=ee&amp;smtButton=Submit
  </code></pre>
  
  <p>And am getting the result as:</p>
  
  <pre><code>firstname = undefined
  lastname = undefined
  age = undefined
  </code></pre>
  
  <p>Could anyone help me to solve this?</p>
  
  <p>JS:</p>
  
  <pre><code>function getParams() {
      var idx = document.URL.indexOf('?');
      var params = new Array();
      if (idx != -1) {
          var pairs = document.URL.substring(idx + 1, document.URL.length).split('&amp;');
          for (var i = 0; i &lt; pairs.length; i++) {
              nameVal = pairs[i].split('=');
              params[nameVal[0]] = nameVal[1];
          }
      }
      return params;
  }
  
  params = getParams();
  firstname = unescape(params["firstname"]);
  lastname = unescape(params["lastname"]);
  age = unescape(params["age"]);
  document.write("firstname = " + firstname + "&lt;br&gt;");
  document.write("lastname = " + lastname + "&lt;br&gt;");
  document.write("age = " + age + "&lt;br&gt;");
  </code></pre>